OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // TODO(gram): | 5 // TODO(gram): |
6 // Unfortunately I can't seem to test anything that involves timeouts, e.g. | 6 // Unfortunately I can't seem to test anything that involves timeouts, e.g. |
7 // insufficient callbacks, because the timeout is controlled externally | 7 // insufficient callbacks, because the timeout is controlled externally |
8 // (test.dart?), and we would need to use a shorter timeout for the inner tests | 8 // (test.dart?), and we would need to use a shorter timeout for the inner tests |
9 // so the outer timeout doesn't fire. So I removed all such tests. | 9 // so the outer timeout doesn't fire. So I removed all such tests. |
10 // I'd like to revisit this at some point. | 10 // I'd like to revisit this at some point. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 excesscallback(); | 287 excesscallback(); |
288 excesscallback(); | 288 excesscallback(); |
289 excesscallback(); | 289 excesscallback(); |
290 callback(); | 290 callback(); |
291 }); | 291 }); |
292 }); | 292 }); |
293 }); | 293 }); |
294 }); | 294 }); |
295 test('foo6', () { | 295 test('foo6', () { |
296 }); | 296 }); |
| 297 } else if (testName == 'testCases immutable') { |
| 298 test(testName, () { |
| 299 expect(() => testCases.clear(), throwsUnsupportedError); |
| 300 expect(() => testCases.removeLast(), throwsUnsupportedError); |
| 301 }); |
297 } | 302 } |
298 }); | 303 }); |
299 } | 304 } |
300 | 305 |
301 void nextTest(int testNum) { | 306 void nextTest(int testNum) { |
302 SendPort sport = spawnFunction(runTest); | 307 SendPort sport = spawnFunction(runTest); |
303 sport.call(tests[testNum]).then((msg) { | 308 sport.call(tests[testNum]).then((msg) { |
304 actual.add(msg); | 309 actual.add(msg); |
305 if (actual.length == expected.length) { | 310 if (actual.length == expected.length) { |
306 for (var i = 0; i < tests.length; i++) { | 311 for (var i = 0; i < tests.length; i++) { |
(...skipping 15 matching lines...) Expand all Loading... |
322 'teardown test', | 327 'teardown test', |
323 'setup and teardown test', | 328 'setup and teardown test', |
324 'correct callback test', | 329 'correct callback test', |
325 'excess callback test', | 330 'excess callback test', |
326 'completion test', | 331 'completion test', |
327 'async exception test', | 332 'async exception test', |
328 'late exception test', | 333 'late exception test', |
329 'middle exception test', | 334 'middle exception test', |
330 'async setup/teardown test', | 335 'async setup/teardown test', |
331 'test returning future', | 336 'test returning future', |
332 'test returning future using Timer' | 337 'test returning future using Timer', |
| 338 'testCases immutable' |
333 ]; | 339 ]; |
334 | 340 |
335 expected = [ | 341 expected = [ |
336 buildStatusString(1, 0, 0, tests[0]), | 342 buildStatusString(1, 0, 0, tests[0]), |
337 buildStatusString(0, 1, 0, tests[1], | 343 buildStatusString(0, 1, 0, tests[1], |
338 message: 'Expected: <5> but: was <4>.'), | 344 message: 'Expected: <5> but: was <4>.'), |
339 buildStatusString(0, 1, 0, tests[2], message: 'Caught Exception: Fail.'), | 345 buildStatusString(0, 1, 0, tests[2], message: 'Caught Exception: Fail.'), |
340 buildStatusString(2, 0, 0, 'a a::a b b'), | 346 buildStatusString(2, 0, 0, 'a a::a b b'), |
341 buildStatusString(1, 0, 0, 'a ${tests[4]}', count: 0, setup: 'setup'), | 347 buildStatusString(1, 0, 0, 'a ${tests[4]}', count: 0, setup: 'setup'), |
342 buildStatusString(1, 0, 0, 'a ${tests[5]}', count: 0, setup: '', | 348 buildStatusString(1, 0, 0, 'a ${tests[5]}', count: 0, setup: '', |
(...skipping 26 matching lines...) Expand all Loading... |
369 'error2:Callback called more times than expected (1).:' | 375 'error2:Callback called more times than expected (1).:' |
370 'fail2:failure:' | 376 'fail2:failure:' |
371 'foo5'), | 377 'foo5'), |
372 buildStatusString(2, 4, 0, | 378 buildStatusString(2, 4, 0, |
373 'successful::' | 379 'successful::' |
374 'fail1:Expected: <false> but: was <true>.:' | 380 'fail1:Expected: <false> but: was <true>.:' |
375 'error1:Callback called more times than expected (1).:' | 381 'error1:Callback called more times than expected (1).:' |
376 'fail2:failure:' | 382 'fail2:failure:' |
377 'error2:Callback called more times than expected (1).:' | 383 'error2:Callback called more times than expected (1).:' |
378 'foo6'), | 384 'foo6'), |
| 385 buildStatusString(1, 0, 0, 'testCases immutable'), |
379 ]; | 386 ]; |
380 | 387 |
381 actual = []; | 388 actual = []; |
382 | 389 |
383 nextTest(0); | 390 nextTest(0); |
384 } | 391 } |
385 | 392 |
OLD | NEW |