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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 expect(s.toString(), "EGHIHJHKHL"); | 398 expect(s.toString(), "EGHIHJHKHL"); |
399 }); | 399 }); |
400 } | 400 } |
401 }); | 401 }); |
402 } | 402 } |
403 | 403 |
404 main() { | 404 main() { |
405 var tests = { | 405 var tests = { |
406 'single correct test': buildStatusString(1, 0, 0, 'single correct test'), | 406 'single correct test': buildStatusString(1, 0, 0, 'single correct test'), |
407 'single failing test': buildStatusString(0, 1, 0, 'single failing test', | 407 'single failing test': buildStatusString(0, 1, 0, 'single failing test', |
408 message: 'Expected: <5> but: was <4>.'), | 408 message: 'Expected: <5> But: was <4>.'), |
409 'exception test': buildStatusString(0, 1, 0, 'exception test', | 409 'exception test': buildStatusString(0, 1, 0, 'exception test', |
410 message: 'Caught Exception: Fail.'), | 410 message: 'Caught Exception: Fail.'), |
411 'group name test': buildStatusString(2, 0, 0, 'a a::a b b'), | 411 'group name test': buildStatusString(2, 0, 0, 'a a::a b b'), |
412 'setup test': buildStatusString(1, 0, 0, 'a setup test', | 412 'setup test': buildStatusString(1, 0, 0, 'a setup test', |
413 count: 0, setup: 'setup'), | 413 count: 0, setup: 'setup'), |
414 'teardown test': buildStatusString(1, 0, 0, 'a teardown test', | 414 'teardown test': buildStatusString(1, 0, 0, 'a teardown test', |
415 count: 0, setup: '', teardown: 'teardown'), | 415 count: 0, setup: '', teardown: 'teardown'), |
416 'setup and teardown test': buildStatusString(1, 0, 0, | 416 'setup and teardown test': buildStatusString(1, 0, 0, |
417 'a setup and teardown test', count: 0, setup: 'setup', | 417 'a setup and teardown test', count: 0, setup: 'setup', |
418 teardown: 'teardown'), | 418 teardown: 'teardown'), |
419 'correct callback test': buildStatusString(1, 0, 0, 'correct callback test', | 419 'correct callback test': buildStatusString(1, 0, 0, 'correct callback test', |
420 count: 1), | 420 count: 1), |
421 'excess callback test': buildStatusString(0, 1, 0, 'excess callback test', | 421 'excess callback test': buildStatusString(0, 1, 0, 'excess callback test', |
422 count: 1, message: 'Callback called more times than expected (1).'), | 422 count: 1, message: 'Callback called more times than expected (1).'), |
423 'completion test': buildStatusString(1, 0, 0, 'completion test', count: 10), | 423 'completion test': buildStatusString(1, 0, 0, 'completion test', count: 10), |
424 'async exception test': buildStatusString(0, 1, 0, 'async exception test', | 424 'async exception test': buildStatusString(0, 1, 0, 'async exception test', |
425 message: 'Caught error!'), | 425 message: 'Caught error!'), |
426 'late exception test': buildStatusString(1, 0, 1, 'testOne', | 426 'late exception test': buildStatusString(1, 0, 1, 'testOne', |
427 message: 'Callback called (2) after test case testOne has already ' | 427 message: 'Callback called (2) after test case testOne has already ' |
428 'been marked as pass.:testTwo:'), | 428 'been marked as pass.:testTwo:'), |
429 'middle exception test': buildStatusString(2, 1, 0, | 429 'middle exception test': buildStatusString(2, 1, 0, |
430 'testOne::testTwo:Expected: false but: was <true>.:testThree'), | 430 'testOne::testTwo:Expected: false But: was <true>.:testThree'), |
431 'async setup/teardown test': buildStatusString(2, 0, 3, | 431 'async setup/teardown test': buildStatusString(2, 0, 3, |
432 'good setup/good teardown foo1::' | 432 'good setup/good teardown foo1::' |
433 'good setup/bad teardown foo2:good setup/bad teardown ' | 433 'good setup/bad teardown foo2:good setup/bad teardown ' |
434 'foo2: Test teardown failed: Failed to complete tearDown:' | 434 'foo2: Test teardown failed: Failed to complete tearDown:' |
435 'bad setup/good teardown foo3:bad setup/good teardown ' | 435 'bad setup/good teardown foo3:bad setup/good teardown ' |
436 'foo3: Test setup failed: Failed to complete setUp:' | 436 'foo3: Test setup failed: Failed to complete setUp:' |
437 'bad setup/bad teardown foo4:bad setup/bad teardown ' | 437 'bad setup/bad teardown foo4:bad setup/bad teardown ' |
438 'foo4: Test teardown failed: Failed to complete tearDown:' | 438 'foo4: Test teardown failed: Failed to complete tearDown:' |
439 'post groups'), | 439 'post groups'), |
440 'test returning future': buildStatusString(2, 4, 0, | 440 'test returning future': buildStatusString(2, 4, 0, |
441 'successful::' | 441 'successful::' |
442 'error1:Callback called more times than expected (1).:' | 442 'error1:Callback called more times than expected (1).:' |
443 'fail1:Expected: <false> but: was <true>.:' | 443 'fail1:Expected: <false> But: was <true>.:' |
444 'error2:Callback called more times than expected (1).:' | 444 'error2:Callback called more times than expected (1).:' |
445 'fail2:failure:' | 445 'fail2:failure:' |
446 'foo5'), | 446 'foo5'), |
447 'test returning future using runAsync': buildStatusString(2, 4, 0, | 447 'test returning future using runAsync': buildStatusString(2, 4, 0, |
448 'successful::' | 448 'successful::' |
449 'fail1:Expected: <false> but: was <true>.:' | 449 'fail1:Expected: <false> But: was <true>.:' |
450 'error1:Callback called more times than expected (1).:' | 450 'error1:Callback called more times than expected (1).:' |
451 'fail2:failure:' | 451 'fail2:failure:' |
452 'error2:Callback called more times than expected (1).:' | 452 'error2:Callback called more times than expected (1).:' |
453 'foo6'), | 453 'foo6'), |
454 'testCases immutable': | 454 'testCases immutable': |
455 buildStatusString(1, 0, 0, 'testCases immutable'), | 455 buildStatusString(1, 0, 0, 'testCases immutable'), |
456 'runTests without tests': buildStatusString(0, 0, 0, null), | 456 'runTests without tests': buildStatusString(0, 0, 0, null), |
457 'nested groups setup/teardown': | 457 'nested groups setup/teardown': |
458 buildStatusString(2, 0, 0, | 458 buildStatusString(2, 0, 0, |
459 'level 1 level 2 level 3 level 4 level 5 level 6 inner::' | 459 'level 1 level 2 level 3 level 4 level 5 level 6 inner::' |
(...skipping 10 matching lines...) Expand all Loading... |
470 'final') | 470 'final') |
471 }; | 471 }; |
472 | 472 |
473 tests.forEach((String name, String expected) { | 473 tests.forEach((String name, String expected) { |
474 test(name, () => spawnFunction(runTest) | 474 test(name, () => spawnFunction(runTest) |
475 .call(name) | 475 .call(name) |
476 .then((String msg) => expect(msg.trim(), equals(expected)))); | 476 .then((String msg) => expect(msg.trim(), equals(expected)))); |
477 }); | 477 }); |
478 } | 478 } |
479 | 479 |
OLD | NEW |