Skip to content

Commit 1107757

Browse files
committed
Add test for Techempower Framework Benchmarks
cc #37
1 parent 8179de5 commit 1107757

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head><title>Fortunes</title></head>
4+
<body>
5+
<table>
6+
<tr><th>id</th><th>message</th></tr>
7+
<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&#039;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>&lt;script&gt;alert(&quot;This should not be displayed in a browser alert box.&quot;);&lt;/script&gt;</td></tr><tr><td>12</td><td>フレームワークのベンチマーク</td></tr>
8+
</table>
9+
</body>
10+
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head><title>Fortunes</title></head>
4+
<body>
5+
<table>
6+
<tr><th>id</th><th>message</th></tr>
7+
<% for item in items { %><tr><td><%= item.id %></td><td><%= item.message %></td></tr><% } %>
8+
</table>
9+
</body>
10+
</html>

sailfish-tests/integration-tests/tests/template_once.rs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,76 @@ fn test_teams() {
154154
assert_render("teams", teams);
155155
}
156156

157+
#[derive(TemplateOnce)]
158+
#[template(path = "techempower.stpl", rm_whitespace = true)]
159+
struct Techempower {
160+
items: Vec<Fortune>,
161+
}
162+
163+
struct Fortune {
164+
id: i32,
165+
message: &'static str,
166+
}
167+
168+
#[test]
169+
fn test_techempower() {
170+
let items = vec![
171+
Fortune {
172+
id: 0,
173+
message: "Additional fortune added at request time.",
174+
},
175+
Fortune {
176+
id: 1,
177+
message: "fortune: No such file or directory",
178+
},
179+
Fortune {
180+
id: 2,
181+
message: "A computer scientist is someone who fixes things that aren't broken.",
182+
},
183+
Fortune {
184+
id: 3,
185+
message: "After enough decimal places, nobody gives a damn.",
186+
},
187+
Fortune {
188+
id: 4,
189+
message: "A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1",
190+
},
191+
Fortune {
192+
id: 5,
193+
message: "A computer program does what you tell it to do, not what you want it to do.",
194+
},
195+
Fortune {
196+
id: 6,
197+
message: "Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen",
198+
},
199+
Fortune {
200+
id: 7,
201+
message: "Any program that runs right is obsolete.",
202+
},
203+
Fortune {
204+
id: 8,
205+
message: "A list is only as strong as its weakest link. — Donald Knuth",
206+
},
207+
Fortune {
208+
id: 9,
209+
message: "Feature: A bug with seniority.",
210+
},
211+
Fortune {
212+
id: 10,
213+
message: "Computers make very fast, very accurate mistakes.",
214+
},
215+
Fortune {
216+
id: 11,
217+
message: "<script>alert(\"This should not be displayed in a browser alert box.\");</script>",
218+
},
219+
Fortune {
220+
id: 12,
221+
message: "フレームワークのベンチマーク",
222+
},
223+
];
224+
assert_render("techempower", Techempower { items });
225+
}
226+
157227
#[derive(TemplateOnce)]
158228
#[template(path = "rm_whitespace.stpl")]
159229
#[template(rm_whitespace = true)]

0 commit comments

Comments
 (0)