parent
8179de521d
commit
1107757ad1
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Fortunes</title></head>
|
||||
<body>
|
||||
<table>
|
||||
<tr><th>id</th><th>message</th></tr>
|
||||
<tr><td>0</td><td>Additional fortune added at request time.</td></tr><tr><td>1</td><td>fortune: No such file or directory</td></tr><tr><td>2</td><td>A computer scientist is someone who fixes things that aren't broken.</td></tr><tr><td>3</td><td>After enough decimal places, nobody gives a damn.</td></tr><tr><td>4</td><td>A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1</td></tr><tr><td>5</td><td>A computer program does what you tell it to do, not what you want it to do.</td></tr><tr><td>6</td><td>Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen</td></tr><tr><td>7</td><td>Any program that runs right is obsolete.</td></tr><tr><td>8</td><td>A list is only as strong as its weakest link. — Donald Knuth</td></tr><tr><td>9</td><td>Feature: A bug with seniority.</td></tr><tr><td>10</td><td>Computers make very fast, very accurate mistakes.</td></tr><tr><td>11</td><td><script>alert("This should not be displayed in a browser alert box.");</script></td></tr><tr><td>12</td><td>フレームワークのベンチマーク</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Fortunes</title></head>
|
||||
<body>
|
||||
<table>
|
||||
<tr><th>id</th><th>message</th></tr>
|
||||
<% for item in items { %><tr><td><%= item.id %></td><td><%= item.message %></td></tr><% } %>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -154,6 +154,76 @@ fn test_teams() {
|
|||
assert_render("teams", teams);
|
||||
}
|
||||
|
||||
#[derive(TemplateOnce)]
|
||||
#[template(path = "techempower.stpl", rm_whitespace = true)]
|
||||
struct Techempower {
|
||||
items: Vec<Fortune>,
|
||||
}
|
||||
|
||||
struct Fortune {
|
||||
id: i32,
|
||||
message: &'static str,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_techempower() {
|
||||
let items = vec![
|
||||
Fortune {
|
||||
id: 0,
|
||||
message: "Additional fortune added at request time.",
|
||||
},
|
||||
Fortune {
|
||||
id: 1,
|
||||
message: "fortune: No such file or directory",
|
||||
},
|
||||
Fortune {
|
||||
id: 2,
|
||||
message: "A computer scientist is someone who fixes things that aren't broken.",
|
||||
},
|
||||
Fortune {
|
||||
id: 3,
|
||||
message: "After enough decimal places, nobody gives a damn.",
|
||||
},
|
||||
Fortune {
|
||||
id: 4,
|
||||
message: "A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1",
|
||||
},
|
||||
Fortune {
|
||||
id: 5,
|
||||
message: "A computer program does what you tell it to do, not what you want it to do.",
|
||||
},
|
||||
Fortune {
|
||||
id: 6,
|
||||
message: "Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen",
|
||||
},
|
||||
Fortune {
|
||||
id: 7,
|
||||
message: "Any program that runs right is obsolete.",
|
||||
},
|
||||
Fortune {
|
||||
id: 8,
|
||||
message: "A list is only as strong as its weakest link. — Donald Knuth",
|
||||
},
|
||||
Fortune {
|
||||
id: 9,
|
||||
message: "Feature: A bug with seniority.",
|
||||
},
|
||||
Fortune {
|
||||
id: 10,
|
||||
message: "Computers make very fast, very accurate mistakes.",
|
||||
},
|
||||
Fortune {
|
||||
id: 11,
|
||||
message: "<script>alert(\"This should not be displayed in a browser alert box.\");</script>",
|
||||
},
|
||||
Fortune {
|
||||
id: 12,
|
||||
message: "フレームワークのベンチマーク",
|
||||
},
|
||||
];
|
||||
assert_render("techempower", Techempower { items });
|
||||
}
|
||||
|
||||
#[derive(TemplateOnce)]
|
||||
#[template(path = "rm_whitespace.stpl")]
|
||||
#[template(rm_whitespace = true)]
|
||||
|
|
Loading…
Reference in New Issue