OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library testrunner_test; | 5 library testrunner_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
11 var dart; | 11 var dart; |
12 var debug = false; | 12 var debug = false; |
13 | 13 |
14 Future runTestrunner(command, List<String> args, | 14 Future runTestrunner( |
15 List<String> stdout, List<String> stderr) { | 15 command, List<String> args, List<String> stdout, List<String> stderr) { |
16 if (debug) { | 16 if (debug) { |
17 print("Running $command ${args.join(' ')}"); | 17 print("Running $command ${args.join(' ')}"); |
18 } | 18 } |
19 return Process.run(command, args).then((ProcessResult result) { | 19 return Process.run(command, args).then((ProcessResult result) { |
20 var lineEndings = new RegExp("\r\n|\n"); | 20 var lineEndings = new RegExp("\r\n|\n"); |
21 stdout.addAll(result.stdout.trim().split(lineEndings)); | 21 stdout.addAll(result.stdout.trim().split(lineEndings)); |
22 stderr.addAll(result.stderr.trim().split(lineEndings)); | 22 stderr.addAll(result.stderr.trim().split(lineEndings)); |
23 }) | 23 }).catchError((e) { |
24 .catchError((e) { | |
25 stderr.add("Error starting process:"); | 24 stderr.add("Error starting process:"); |
26 stderr.add(" Command: $command"); | 25 stderr.add(" Command: $command"); |
27 stderr.add(" Error: ${e}"); | 26 stderr.add(" Error: ${e}"); |
28 completer.complete(-1); | 27 completer.complete(-1); |
29 }); | 28 }); |
30 } | 29 } |
31 | 30 |
32 // Useful utility for debugging test failures. | 31 // Useful utility for debugging test failures. |
33 void dump(label, list) { | 32 void dump(label, list) { |
34 if (!debug) return; | 33 if (!debug) return; |
35 print('\n@=[ $label ]=============================\n'); | 34 print('\n@=[ $label ]=============================\n'); |
36 for (var i = 0; i < list.length; i++) | 35 for (var i = 0; i < list.length; i++) { |
37 print('@ ${list[i]}\n'); | 36 print('@ ${list[i]}\n'); |
| 37 } |
38 print('------------------------------------------\n'); | 38 print('------------------------------------------\n'); |
39 } | 39 } |
40 | 40 |
41 int stringCompare(String s1, String s2) => s1.compareTo(s2); | 41 int stringCompare(String s1, String s2) => s1.compareTo(s2); |
42 | 42 |
43 Future runTest( | 43 Future runTest(List<String> args, List<String> expected_stdout, |
44 List<String> args, | |
45 List<String> expected_stdout, | |
46 {List<String> expected_stderr, sort: false}) { | 44 {List<String> expected_stderr, sort: false}) { |
47 var stdout = new List<String>(); | 45 var stdout = new List<String>(); |
48 var stderr = new List<String>(); | 46 var stderr = new List<String>(); |
49 for (var i = 0; i < expected_stdout.length; i++) { | 47 for (var i = 0; i < expected_stdout.length; i++) { |
50 expected_stdout[i] = expected_stdout[i]. | 48 expected_stdout[i] = |
51 replaceAll('/', Platform.pathSeparator); | 49 expected_stdout[i].replaceAll('/', Platform.pathSeparator); |
52 } | 50 } |
53 if (debug) { | 51 if (debug) { |
54 args.insert(1, "--log=stderr"); | 52 args.insert(1, "--log=stderr"); |
55 } | 53 } |
56 var rtn = runTestrunner(dart, args, stdout, stderr); | 54 var rtn = runTestrunner(dart, args, stdout, stderr); |
57 rtn.then((_) { | 55 rtn.then((_) { |
58 dump('stderr', stderr); | 56 dump('stderr', stderr); |
59 dump('stdout', stdout); | 57 dump('stdout', stdout); |
60 | 58 |
61 if (expected_stderr != null) { | 59 if (expected_stderr != null) { |
(...skipping 10 matching lines...) Expand all Loading... |
72 fail("Extra text in output: ${stdout[i]}"); | 70 fail("Extra text in output: ${stdout[i]}"); |
73 return; | 71 return; |
74 } | 72 } |
75 var actual = stdout[i].trim(); | 73 var actual = stdout[i].trim(); |
76 if (debug) { | 74 if (debug) { |
77 print("Compare <$actual> and <${expected_stdout[l]}>"); | 75 print("Compare <$actual> and <${expected_stdout[l]}>"); |
78 } | 76 } |
79 if (expected_stdout[l].startsWith('*')) { | 77 if (expected_stdout[l].startsWith('*')) { |
80 expect(actual, endsWith(expected_stdout[l].substring(1))); | 78 expect(actual, endsWith(expected_stdout[l].substring(1))); |
81 } else if (expected_stdout[l].startsWith('?')) { | 79 } else if (expected_stdout[l].startsWith('?')) { |
82 » var pat = expected_stdout[l].substring(1); | 80 var pat = expected_stdout[l].substring(1); |
83 » if (Platform.operatingSystem == 'windows') { | 81 if (Platform.operatingSystem == 'windows') { |
84 » // The joys of Windows... | 82 // The joys of Windows... |
85 » pat = pat.replaceAll('\\','\\\\'); | 83 pat = pat.replaceAll('\\', '\\\\'); |
86 } | 84 } |
87 expect(actual, matches(pat));»» | 85 expect(actual, matches(pat)); |
88 } else { | 86 } else { |
89 expect(actual, expected_stdout[l]); | 87 expect(actual, expected_stdout[l]); |
90 } | 88 } |
91 ++l; | 89 ++l; |
92 } | 90 } |
93 } | 91 } |
94 if (l < expected_stdout.length) { | 92 if (l < expected_stdout.length) { |
95 fail("Only matched $l of ${expected_stdout.length} lines"); | 93 fail("Only matched $l of ${expected_stdout.length} lines"); |
96 } | 94 } |
97 }); | 95 }); |
98 return rtn; | 96 return rtn; |
99 } | 97 } |
100 | 98 |
101 // A useful function to quickly disable a group of tests; just | 99 // A useful function to quickly disable a group of tests; just |
102 // replace group() with skip_group(). | 100 // replace group() with skip_group(). |
103 skip_group(_1,_2) {} | 101 skip_group(_1, _2) {} |
104 | 102 |
105 main() { | 103 main() { |
106 dart = Platform.executable; | 104 dart = Platform.executable; |
107 var idx = dart.indexOf('dart-sdk'); | 105 var idx = dart.indexOf('dart-sdk'); |
108 if (idx < 0) { | 106 if (idx < 0) { |
109 print("Please run using the dart executable from the Dart SDK"); | 107 print("Please run using the dart executable from the Dart SDK"); |
110 exit(-1); | 108 exit(-1); |
111 } | 109 } |
112 var _ = Platform.pathSeparator; | 110 var _ = Platform.pathSeparator; |
113 var testrunner = '../../testrunner/testrunner.dart' | 111 var testrunner = '../../testrunner/testrunner.dart' |
114 .replaceAll('/', Platform.pathSeparator); | 112 .replaceAll('/', Platform.pathSeparator); |
115 | 113 |
116 group("list tests", () { | 114 group("list tests", () { |
117 test('list file', () { | 115 test('list file', () { |
118 return runTest( | 116 return runTest([testrunner, '--list-files', 'non_browser_tests'], |
119 [ testrunner, | 117 ['?.*/non_browser_tests/non_browser_test.dart']); |
120 '--list-files', | |
121 'non_browser_tests' ], | |
122 [ '?.*/non_browser_tests/non_browser_test.dart' ]); | |
123 }); | 118 }); |
124 test('list files', () { | 119 test('list files', () { |
125 return runTest( | 120 return runTest([ |
126 [ testrunner, | 121 testrunner, |
127 '--recurse', | 122 '--recurse', |
128 '--sort', | 123 '--sort', |
129 '--list-files', | 124 '--list-files', |
130 '--test-file-pattern=.dart\$' ], | 125 '--test-file-pattern=.dart\$' |
131 [ '*browser_tests/web/browser_test.dart', | 126 ], [ |
132 '*http_client_tests/http_client_test.dart', | 127 '*browser_tests/web/browser_test.dart', |
133 '*layout_tests/web/layout_test.dart', | 128 '*http_client_tests/http_client_test.dart', |
134 '*non_browser_tests/non_browser_test.dart', | 129 '*layout_tests/web/layout_test.dart', |
135 '*non_browser_tests/non_browser_toast.dart', | 130 '*non_browser_tests/non_browser_test.dart', |
136 '*/testrunner_test.dart' ] | 131 '*non_browser_tests/non_browser_toast.dart', |
137 ); | 132 '*/testrunner_test.dart' |
| 133 ]); |
138 }); | 134 }); |
139 test('list files', () { | 135 test('list files', () { |
140 return runTest( | 136 return runTest([ |
141 [ testrunner, | 137 testrunner, |
142 '--list-files', | 138 '--list-files', |
143 '--test-file-pattern=.dart\$', | 139 '--test-file-pattern=.dart\$', |
144 'non_browser_tests' ], | 140 'non_browser_tests' |
145 [ '*non_browser_tests/non_browser_test.dart', | 141 ], [ |
146 '*non_browser_tests/non_browser_toast.dart' ], | 142 '*non_browser_tests/non_browser_test.dart', |
147 sort:true | 143 '*non_browser_tests/non_browser_toast.dart' |
148 ); | 144 ], sort: true); |
149 }); | 145 }); |
150 test('list groups', () { | 146 test('list groups', () { |
151 return runTest( | 147 return runTest([ |
152 [ testrunner, | 148 testrunner, |
153 '--list-groups', | 149 '--list-groups', |
154 'non_browser_tests' ], | 150 'non_browser_tests' |
155 [ '*non_browser_tests/non_browser_test.dart group1', | 151 ], [ |
156 '*non_browser_tests/non_browser_test.dart group2']); | 152 '*non_browser_tests/non_browser_test.dart group1', |
| 153 '*non_browser_tests/non_browser_test.dart group2' |
| 154 ]); |
157 }); | 155 }); |
158 test('list tests', () { | 156 test('list tests', () { |
159 return runTest( | 157 return runTest([ |
160 [ testrunner, | 158 testrunner, |
161 '--list-tests', | 159 '--list-tests', |
162 'non_browser_tests' ], | 160 'non_browser_tests' |
163 [ '*non_browser_tests/non_browser_test.dart group1 test1', | 161 ], [ |
164 '*non_browser_tests/non_browser_test.dart group2 test2' ]); | 162 '*non_browser_tests/non_browser_test.dart group1 test1', |
| 163 '*non_browser_tests/non_browser_test.dart group2 test2' |
| 164 ]); |
165 }); | 165 }); |
166 }); | 166 }); |
167 | 167 |
168 group("vm", () { | 168 group("vm", () { |
169 test("vm without timing info", () { | 169 test("vm without timing info", () { |
170 return runTest( | 170 return runTest([ |
171 [ testrunner, | 171 testrunner, |
172 '--recurse', | 172 '--recurse', |
173 'non_browser_tests' ], | 173 'non_browser_tests' |
174 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' | 174 ], [ |
175 ' Expected: false', | 175 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' |
176 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' ]); | 176 ' Expected: false', |
177 }); | 177 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' |
178 | 178 ]); |
| 179 }); |
| 180 |
179 test("vm with timing info", () { | 181 test("vm with timing info", () { |
180 return runTest( | 182 return runTest([ |
181 [ testrunner, | 183 testrunner, |
182 '--recurse', | 184 '--recurse', |
183 '--time', | 185 '--time', |
184 'non_browser_tests' ], | 186 'non_browser_tests' |
185 [ '?FAIL [0-9.]+s .*/non_browser_tests/non_browser_test.dart group1' | 187 ], [ |
186 ' test1 Expected: false', | 188 '?FAIL [0-9.]+s .*/non_browser_tests/non_browser_test.dart group1' |
187 '?PASS [0-9.]+s .*/non_browser_tests/non_browser_test.dart group2' | 189 ' test1 Expected: false', |
188 ' test2' ]); | 190 '?PASS [0-9.]+s .*/non_browser_tests/non_browser_test.dart group2' |
189 }); | 191 ' test2' |
190 }); | 192 ]); |
191 | 193 }); |
| 194 }); |
| 195 |
192 group("selection", () { | 196 group("selection", () { |
193 test("--include", () { | 197 test("--include", () { |
194 return runTest( | 198 return runTest([ |
195 [ testrunner, | 199 testrunner, |
196 '--recurse', | 200 '--recurse', |
197 '--include=group1', | 201 '--include=group1', |
198 'non_browser_tests' ], | 202 'non_browser_tests' |
199 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' | 203 ], [ |
200 'Expected: false' ]); | 204 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' |
201 }); | 205 'Expected: false' |
202 | 206 ]); |
| 207 }); |
| 208 |
203 test("--exclude", () { | 209 test("--exclude", () { |
204 return runTest( | 210 return runTest( |
205 [ testrunner, | 211 [testrunner, '--recurse', '--exclude=group1', 'non_browser_tests'], |
206 '--recurse', | 212 ['?PASS .*/non_browser_tests/non_browser_test.dart group2 test2']); |
207 '--exclude=group1', | 213 }); |
208 'non_browser_tests' ], | 214 |
209 [ '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' ]); | |
210 }); | |
211 | |
212 test("test file pattern", () { | 215 test("test file pattern", () { |
213 return runTest( | 216 return runTest([ |
214 [ testrunner, | 217 testrunner, |
215 '--recurse', | 218 '--recurse', |
216 '--test-file-pattern=toast', | 219 '--test-file-pattern=toast', |
217 'non_browser_tests' ], | 220 'non_browser_tests' |
218 [ '?PASS .*/non_browser_tests/non_browser_toast.dart foo bar' ]); | 221 ], [ |
| 222 '?PASS .*/non_browser_tests/non_browser_toast.dart foo bar' |
| 223 ]); |
219 }); | 224 }); |
220 }); | 225 }); |
221 | 226 |
222 group("stop on failure tests", () { | 227 group("stop on failure tests", () { |
223 test("without stop", () { | 228 test("without stop", () { |
224 return runTest( | 229 return runTest([ |
225 [ testrunner, | 230 testrunner, |
226 '--recurse', | 231 '--recurse', |
227 '--sort', | 232 '--sort', |
228 '--tasks=1', | 233 '--tasks=1', |
229 '--test-file-pattern=.dart\$', | 234 '--test-file-pattern=.dart\$', |
230 'non_browser_tests' ], | 235 'non_browser_tests' |
231 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' | 236 ], [ |
232 'Expected: false', | 237 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' |
233 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2', | 238 'Expected: false', |
234 '?PASS .*/non_browser_tests/non_browser_toast.dart foo bar' ]); | 239 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2', |
| 240 '?PASS .*/non_browser_tests/non_browser_toast.dart foo bar' |
| 241 ]); |
235 }); | 242 }); |
236 test("with stop", () { | 243 test("with stop", () { |
237 return runTest( | 244 return runTest([ |
238 [ testrunner, | 245 testrunner, |
239 '--recurse', | 246 '--recurse', |
240 '--sort', | 247 '--sort', |
241 '--tasks=1', | 248 '--tasks=1', |
242 '--test-file-pattern=.dart\$', | 249 '--test-file-pattern=.dart\$', |
243 '--stop-on-failure', | 250 '--stop-on-failure', |
244 'non_browser_tests' ], | 251 'non_browser_tests' |
245 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' | 252 ], [ |
246 'Expected: false', | 253 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' |
247 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' ]); | 254 'Expected: false', |
| 255 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' |
| 256 ]); |
248 }); | 257 }); |
249 }); | 258 }); |
250 | 259 |
251 group("output control", () { | 260 group("output control", () { |
252 test("summary test", () { | 261 test("summary test", () { |
253 return runTest( | 262 return runTest([ |
254 [ testrunner, | 263 testrunner, |
255 '--recurse', | 264 '--recurse', |
256 '--summary', | 265 '--summary', |
257 'non_browser_tests' ], | 266 'non_browser_tests' |
258 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' | 267 ], [ |
259 'Expected: false', | 268 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' |
260 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2', | 269 'Expected: false', |
261 '', | 270 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2', |
262 '?.*/non_browser_tests/non_browser_test.dart: ' | 271 '', |
263 '1 PASSED, 1 FAILED, 0 ERRORS' ]); | 272 '?.*/non_browser_tests/non_browser_test.dart: ' |
| 273 '1 PASSED, 1 FAILED, 0 ERRORS' |
| 274 ]); |
264 }); | 275 }); |
265 | 276 |
266 test('list tests with custom format', () { | 277 test('list tests with custom format', () { |
267 return runTest( | 278 return runTest([ |
268 [ testrunner, | 279 testrunner, |
269 '--list-tests', | 280 '--list-tests', |
270 '--list-format="<FILENAME><TESTNAME>"', | 281 '--list-format="<FILENAME><TESTNAME>"', |
271 'non_browser_tests' ], | 282 'non_browser_tests' |
272 [ '?.*/non_browser_tests/non_browser_test.dart test1', | 283 ], [ |
273 '?.*/non_browser_tests/non_browser_test.dart test2' ]); | 284 '?.*/non_browser_tests/non_browser_test.dart test1', |
274 }); | 285 '?.*/non_browser_tests/non_browser_test.dart test2' |
275 | 286 ]); |
| 287 }); |
| 288 |
276 test("custom message formatting", () { | 289 test("custom message formatting", () { |
277 return runTest( | 290 return runTest([ |
278 [ testrunner, | 291 testrunner, |
279 '--recurse', | 292 '--recurse', |
280 '--pass-format=YIPPEE! <GROUPNAME><TESTNAME>', | 293 '--pass-format=YIPPEE! <GROUPNAME><TESTNAME>', |
281 '--fail-format=EPIC FAIL! <GROUPNAME><TESTNAME>', | 294 '--fail-format=EPIC FAIL! <GROUPNAME><TESTNAME>', |
282 'non_browser_tests' ], | 295 'non_browser_tests' |
283 [ 'EPIC FAIL! group1 test1', 'YIPPEE! group2 test2' ]); | 296 ], [ |
| 297 'EPIC FAIL! group1 test1', |
| 298 'YIPPEE! group2 test2' |
| 299 ]); |
284 }); | 300 }); |
285 }); | 301 }); |
286 | 302 |
287 test("checked mode test", () { | 303 test("checked mode test", () { |
288 return runTest( | 304 return runTest([ |
289 [ testrunner, | 305 testrunner, |
290 '--recurse', | 306 '--recurse', |
291 '--checked', | 307 '--checked', |
292 'non_browser_tests' ], | 308 'non_browser_tests' |
293 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' | 309 ], [ |
294 'Expected: false', | 310 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' |
295 "?FAIL .*/non_browser_tests/non_browser_test.dart group2 test2 " | 311 'Expected: false', |
296 "Caught type 'int' is not a subtype of type 'bool' of 'x'." ]); | 312 "?FAIL .*/non_browser_tests/non_browser_test.dart group2 test2 " |
| 313 "Caught type 'int' is not a subtype of type 'bool' of 'x'." |
| 314 ]); |
297 }); | 315 }); |
298 | 316 |
299 group("browser", () { | 317 group("browser", () { |
300 test("native test", () { | 318 test("native test", () { |
301 return runTest( | 319 return runTest([ |
302 [ testrunner, | 320 testrunner, |
303 '--recurse', | 321 '--recurse', |
304 '--runtime=drt-dart', | 322 '--runtime=drt-dart', |
305 'browser_tests' ], | 323 'browser_tests' |
306 [ '?FAIL .*/browser_tests/web/browser_test.dart group1 test1 ' | 324 ], [ |
307 'Expected: false', | 325 '?FAIL .*/browser_tests/web/browser_test.dart group1 test1 ' |
308 '?PASS .*/browser_tests/web/browser_test.dart group2 test2' ]); | 326 'Expected: false', |
309 }); | 327 '?PASS .*/browser_tests/web/browser_test.dart group2 test2' |
310 | 328 ]); |
| 329 }); |
| 330 |
311 test("compiled test", () { | 331 test("compiled test", () { |
312 return runTest( | 332 return runTest([ |
313 [ testrunner, | 333 testrunner, |
314 '--recurse', | 334 '--recurse', |
315 '--runtime=drt-js', | 335 '--runtime=drt-js', |
316 'browser_tests' ], | 336 'browser_tests' |
317 [ '?FAIL .*/browser_tests/web/browser_test.dart group1 test1 ' | 337 ], [ |
318 'Expected: false', | 338 '?FAIL .*/browser_tests/web/browser_test.dart group1 test1 ' |
319 '?PASS .*/browser_tests/web/browser_test.dart group2 test2' ]); | 339 'Expected: false', |
320 }); | 340 '?PASS .*/browser_tests/web/browser_test.dart group2 test2' |
321 }); | 341 ]); |
322 | 342 }); |
| 343 }); |
| 344 |
323 group("textual layout tests", () { | 345 group("textual layout tests", () { |
324 group("drt-dart", () { | 346 group("drt-dart", () { |
325 test("no baseline", () { | 347 test("no baseline", () { |
326 var f = new File("layout_tests/web/layout_test/layout.txt"); | 348 var f = new File("layout_tests/web/layout_test/layout.txt"); |
327 if (f.existsSync()) { | 349 if (f.existsSync()) { |
328 f.deleteSync(); | 350 f.deleteSync(); |
329 } | 351 } |
330 return runTest( | 352 return runTest([ |
331 [ testrunner, | 353 testrunner, |
332 '--runtime=drt-dart', | 354 '--runtime=drt-dart', |
333 '--recurse', | 355 '--recurse', |
334 '--layout-text', | 356 '--layout-text', |
335 'layout_tests' ], | 357 'layout_tests' |
336 [ '?FAIL .*/layout_tests/web/layout_test.dart layout ' | 358 ], [ |
337 'No expectation file' ]); | 359 '?FAIL .*/layout_tests/web/layout_test.dart layout ' |
| 360 'No expectation file' |
| 361 ]); |
338 }); | 362 }); |
339 test("create baseline", () { | 363 test("create baseline", () { |
340 return runTest( | 364 return runTest([ |
341 [ testrunner, | 365 testrunner, |
342 '--runtime=drt-dart', | 366 '--runtime=drt-dart', |
343 '--recurse', | 367 '--recurse', |
344 '--layout-text', | 368 '--layout-text', |
345 '--regenerate', | 369 '--regenerate', |
346 'layout_tests' ], | 370 'layout_tests' |
347 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 371 ], [ |
| 372 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 373 ]); |
348 }); | 374 }); |
349 test("test baseline", () { | 375 test("test baseline", () { |
350 return runTest( | 376 return runTest([ |
351 [ testrunner, | 377 testrunner, |
352 '--runtime=drt-dart', | 378 '--runtime=drt-dart', |
353 '--recurse', | 379 '--recurse', |
354 '--layout-text', | 380 '--layout-text', |
355 'layout_tests' ], | 381 'layout_tests' |
356 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 382 ], [ |
| 383 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 384 ]); |
357 }); | 385 }); |
358 }); | 386 }); |
359 group("drt-js", () { | 387 group("drt-js", () { |
360 test("no baseline", () { | 388 test("no baseline", () { |
361 var f = new File("layout_tests/web/layout_test/layout.txt"); | 389 var f = new File("layout_tests/web/layout_test/layout.txt"); |
362 if (f.existsSync()) { | 390 if (f.existsSync()) { |
363 f.deleteSync(); | 391 f.deleteSync(); |
364 } | 392 } |
365 return runTest( | 393 return runTest([ |
366 [ testrunner, | 394 testrunner, |
367 '--runtime=drt-js', | 395 '--runtime=drt-js', |
368 '--recurse', | 396 '--recurse', |
369 '--layout-text', | 397 '--layout-text', |
370 'layout_tests' ], | 398 'layout_tests' |
371 [ '?FAIL .*/layout_tests/web/layout_test.dart layout ' | 399 ], [ |
372 'No expectation file' ]); | 400 '?FAIL .*/layout_tests/web/layout_test.dart layout ' |
| 401 'No expectation file' |
| 402 ]); |
373 }); | 403 }); |
374 test("create baseline", () { | 404 test("create baseline", () { |
375 return runTest( | 405 return runTest([ |
376 [ testrunner, | 406 testrunner, |
377 '--runtime=drt-js', | 407 '--runtime=drt-js', |
378 '--recurse', | 408 '--recurse', |
379 '--layout-text', | 409 '--layout-text', |
380 '--regenerate', | 410 '--regenerate', |
381 'layout_tests' ], | 411 'layout_tests' |
382 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 412 ], [ |
| 413 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 414 ]); |
383 }); | 415 }); |
384 test("test baseline", () { | 416 test("test baseline", () { |
385 return runTest( | 417 return runTest([ |
386 [ testrunner, | 418 testrunner, |
387 '--runtime=drt-js', | 419 '--runtime=drt-js', |
388 '--recurse', | 420 '--recurse', |
389 '--layout-text', | 421 '--layout-text', |
390 'layout_tests' ], | 422 'layout_tests' |
391 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 423 ], [ |
| 424 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 425 ]); |
392 }); | 426 }); |
393 }); | 427 }); |
394 }); | 428 }); |
395 | 429 |
396 group("pixel layout tests", () { | 430 group("pixel layout tests", () { |
397 group("drt-dart", () { | 431 group("drt-dart", () { |
398 test("no baseline", () { | 432 test("no baseline", () { |
399 var f = new File("layout_tests/web/layout_test/layout.png"); | 433 var f = new File("layout_tests/web/layout_test/layout.png"); |
400 if (f.existsSync()) { | 434 if (f.existsSync()) { |
401 f.deleteSync(); | 435 f.deleteSync(); |
402 } | 436 } |
403 return runTest( | 437 return runTest([ |
404 [ testrunner, | 438 testrunner, |
405 '--runtime=drt-dart', | 439 '--runtime=drt-dart', |
406 '--recurse', | 440 '--recurse', |
407 '--layout-pixel', | 441 '--layout-pixel', |
408 'layout_tests' ], | 442 'layout_tests' |
409 [ '?FAIL .*/layout_tests/web/layout_test.dart layout ' | 443 ], [ |
410 'No expectation file' ]); | 444 '?FAIL .*/layout_tests/web/layout_test.dart layout ' |
| 445 'No expectation file' |
| 446 ]); |
411 }); | 447 }); |
412 test("create baseline", () { | 448 test("create baseline", () { |
413 return runTest( | 449 return runTest([ |
414 [ testrunner, | 450 testrunner, |
415 '--runtime=drt-dart', | 451 '--runtime=drt-dart', |
416 '--recurse', | 452 '--recurse', |
417 '--layout-pixel', | 453 '--layout-pixel', |
418 '--regenerate', | 454 '--regenerate', |
419 'layout_tests' ], | 455 'layout_tests' |
420 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 456 ], [ |
| 457 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 458 ]); |
421 }); | 459 }); |
422 test("test baseline", () { | 460 test("test baseline", () { |
423 return runTest( | 461 return runTest([ |
424 [ testrunner, | 462 testrunner, |
425 '--runtime=drt-dart', | 463 '--runtime=drt-dart', |
426 '--recurse', | 464 '--recurse', |
427 '--layout-pixel', | 465 '--layout-pixel', |
428 'layout_tests' ], | 466 'layout_tests' |
429 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 467 ], [ |
| 468 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 469 ]); |
430 }); | 470 }); |
431 // TODO(gram): Should add a test that changes a byte of the | 471 // TODO(gram): Should add a test that changes a byte of the |
432 // expectation .png. | 472 // expectation .png. |
433 }); | 473 }); |
434 group("drt-js", () { | 474 group("drt-js", () { |
435 test("no baseline", () { | 475 test("no baseline", () { |
436 var f = new File("layout_tests/web/layout_test/layout.png"); | 476 var f = new File("layout_tests/web/layout_test/layout.png"); |
437 if (f.existsSync()) { | 477 if (f.existsSync()) { |
438 f.deleteSync(); | 478 f.deleteSync(); |
439 } | 479 } |
440 return runTest( | 480 return runTest([ |
441 [ testrunner, | 481 testrunner, |
442 '--runtime=drt-js', | 482 '--runtime=drt-js', |
443 '--recurse', | 483 '--recurse', |
444 '--layout-pixel', | 484 '--layout-pixel', |
445 'layout_tests' ], | 485 'layout_tests' |
446 [ '?FAIL .*/layout_tests/web/layout_test.dart layout ' | 486 ], [ |
447 'No expectation file' ]); | 487 '?FAIL .*/layout_tests/web/layout_test.dart layout ' |
| 488 'No expectation file' |
| 489 ]); |
448 }); | 490 }); |
449 test("create baseline", () { | 491 test("create baseline", () { |
450 return runTest( | 492 return runTest([ |
451 [ testrunner, | 493 testrunner, |
452 '--runtime=drt-js', | 494 '--runtime=drt-js', |
453 '--recurse', | 495 '--recurse', |
454 '--layout-pixel', | 496 '--layout-pixel', |
455 '--regenerate', | 497 '--regenerate', |
456 'layout_tests' ], | 498 'layout_tests' |
457 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 499 ], [ |
| 500 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 501 ]); |
458 }); | 502 }); |
459 test("test baseline", () { | 503 test("test baseline", () { |
460 return runTest( | 504 return runTest([ |
461 [ testrunner, | 505 testrunner, |
462 '--runtime=drt-js', | 506 '--runtime=drt-js', |
463 '--recurse', | 507 '--recurse', |
464 '--layout-pixel', | 508 '--layout-pixel', |
465 'layout_tests' ], | 509 'layout_tests' |
466 [ '?PASS .*/layout_tests/web/layout_test.dart layout' ]); | 510 ], [ |
| 511 '?PASS .*/layout_tests/web/layout_test.dart layout' |
| 512 ]); |
467 }); | 513 }); |
468 }); | 514 }); |
469 }); | 515 }); |
470 | 516 |
471 group("run in isolate", () { | 517 group("run in isolate", () { |
472 test("vm", () { | 518 test("vm", () { |
473 return runTest( | 519 return runTest([ |
474 [ testrunner, | 520 testrunner, |
475 '--runtime=vm', | 521 '--runtime=vm', |
476 '--recurse', | 522 '--recurse', |
477 '--isolate', | 523 '--isolate', |
478 'non_browser_tests' ], | 524 'non_browser_tests' |
479 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' | 525 ], [ |
480 ' Expected: false', | 526 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' |
481 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' ]); | 527 ' Expected: false', |
| 528 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' |
| 529 ]); |
482 }); | 530 }); |
483 test("drt-dart", () { | 531 test("drt-dart", () { |
484 return runTest( | 532 return runTest([ |
485 [ testrunner, | 533 testrunner, |
486 '--runtime=drt-dart', | 534 '--runtime=drt-dart', |
487 '--recurse', | 535 '--recurse', |
488 '--isolate', | 536 '--isolate', |
489 'non_browser_tests' ], | 537 'non_browser_tests' |
490 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' | 538 ], [ |
491 ' Expected: false', | 539 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' |
492 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' ]); | 540 ' Expected: false', |
| 541 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' |
| 542 ]); |
493 }); | 543 }); |
494 test("drt-js", () { | 544 test("drt-js", () { |
495 return runTest( | 545 return runTest([ |
496 [ testrunner, | 546 testrunner, |
497 '--runtime=drt-js', | 547 '--runtime=drt-js', |
498 '--recurse', | 548 '--recurse', |
499 '--isolate', | 549 '--isolate', |
500 'non_browser_tests' ], | 550 'non_browser_tests' |
501 [ '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' | 551 ], [ |
502 'Expected: false', | 552 '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' |
503 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' ]); | 553 'Expected: false', |
| 554 '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' |
| 555 ]); |
504 }); | 556 }); |
505 }); | 557 }); |
506 | 558 |
507 group("embedded server", () { | 559 group("embedded server", () { |
508 test("get test", () { | 560 test("get test", () { |
509 return runTest( | 561 return runTest([ |
510 [ testrunner, | 562 testrunner, |
511 '--recurse', | 563 '--recurse', |
512 '--server', | 564 '--server', |
513 '--port=3456', | 565 '--port=3456', |
514 '--root=${Directory.current.path}', | 566 '--root=${Directory.current.path}', |
515 'http_client_tests' ], | 567 'http_client_tests' |
516 [ '?PASS .*/http_client_tests/http_client_test.dart test1', | 568 ], [ |
517 '?PASS .*/http_client_tests/http_client_test.dart test2' ]); | 569 '?PASS .*/http_client_tests/http_client_test.dart test1', |
| 570 '?PASS .*/http_client_tests/http_client_test.dart test2' |
| 571 ]); |
518 }); | 572 }); |
519 }); | 573 }); |
520 } | 574 } |
521 | |
OLD | NEW |