| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 test('inner', () {}); | 337 test('inner', () {}); |
| 338 }); | 338 }); |
| 339 }); | 339 }); |
| 340 }); | 340 }); |
| 341 }); | 341 }); |
| 342 }); | 342 }); |
| 343 }); | 343 }); |
| 344 test('after nest', () { | 344 test('after nest', () { |
| 345 expect(s.toString(), "l1 U l2 U l4 U l5 U l6 D l4 D l2 D "); | 345 expect(s.toString(), "l1 U l2 U l4 U l5 U l6 D l4 D l2 D "); |
| 346 }); | 346 }); |
| 347 } else if (testName == 'skipped/soloed nested groups with setup/teardown') { |
| 348 StringBuffer s = null; |
| 349 setUp(() { |
| 350 if (s == null) |
| 351 s = new StringBuffer(); |
| 352 }); |
| 353 test('top level', () { |
| 354 s.write('A'); |
| 355 }); |
| 356 skip_test('skipped top level', () { |
| 357 s.write('B'); |
| 358 }); |
| 359 skip_group('skipped top level group', () { |
| 360 setUp(() { |
| 361 s.write('C'); |
| 362 }); |
| 363 solo_test('skipped solo nested test', () { |
| 364 s.write('D'); |
| 365 }); |
| 366 }); |
| 367 group('non-solo group', () { |
| 368 setUp(() { |
| 369 s.write('E'); |
| 370 }); |
| 371 test('in non-solo group', () { |
| 372 s.write('F'); |
| 373 }); |
| 374 solo_test('solo_test in non-solo group', () { |
| 375 s.write('G'); |
| 376 }); |
| 377 }); |
| 378 solo_group('solo group', () { |
| 379 setUp(() { |
| 380 s.write('H'); |
| 381 }); |
| 382 test('solo group non-solo test', () { |
| 383 s.write('I'); |
| 384 }); |
| 385 solo_test('solo group solo test', () { |
| 386 s.write('J'); |
| 387 }); |
| 388 group('nested non-solo group in solo group', () { |
| 389 test('nested non-solo group non-solo test', () { |
| 390 s.write('K'); |
| 391 }); |
| 392 solo_test('nested non-solo group solo test', () { |
| 393 s.write('L'); |
| 394 }); |
| 395 }); |
| 396 }); |
| 397 solo_test('final', () { |
| 398 expect(s.toString(), "EGHIHJHKHL"); |
| 399 }); |
| 347 } | 400 } |
| 348 }); | 401 }); |
| 349 } | 402 } |
| 350 | 403 |
| 351 main() { | 404 main() { |
| 352 var tests = { | 405 var tests = { |
| 353 'single correct test': buildStatusString(1, 0, 0, 'single correct test'), | 406 'single correct test': buildStatusString(1, 0, 0, 'single correct test'), |
| 354 'single failing test': buildStatusString(0, 1, 0, 'single failing test', | 407 'single failing test': buildStatusString(0, 1, 0, 'single failing test', |
| 355 message: 'Expected: <5> but: was <4>.'), | 408 message: 'Expected: <5> but: was <4>.'), |
| 356 'exception test': buildStatusString(0, 1, 0, 'exception test', | 409 'exception test': buildStatusString(0, 1, 0, 'exception test', |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 'fail1:Expected: <false> but: was <true>.:' | 449 'fail1:Expected: <false> but: was <true>.:' |
| 397 'error1:Callback called more times than expected (1).:' | 450 'error1:Callback called more times than expected (1).:' |
| 398 'fail2:failure:' | 451 'fail2:failure:' |
| 399 'error2:Callback called more times than expected (1).:' | 452 'error2:Callback called more times than expected (1).:' |
| 400 'foo6'), | 453 'foo6'), |
| 401 'testCases immutable': | 454 'testCases immutable': |
| 402 buildStatusString(1, 0, 0, 'testCases immutable'), | 455 buildStatusString(1, 0, 0, 'testCases immutable'), |
| 403 'runTests without tests': buildStatusString(0, 0, 0, null), | 456 'runTests without tests': buildStatusString(0, 0, 0, null), |
| 404 'nested groups setup/teardown': | 457 'nested groups setup/teardown': |
| 405 buildStatusString(2, 0, 0, | 458 buildStatusString(2, 0, 0, |
| 406 'level 1 level 2 level 3 level 4 level 5 level 6 inner::after nest') | 459 'level 1 level 2 level 3 level 4 level 5 level 6 inner::' |
| 460 'after nest'), |
| 461 'skipped/soloed nested groups with setup/teardown': |
| 462 buildStatusString(6, 0, 0, |
| 463 'non-solo group solo_test in non-solo group::' |
| 464 'solo group solo group non-solo test::' |
| 465 'solo group solo group solo test::' |
| 466 'solo group nested non-solo group in solo group nested non-' |
| 467 'solo group non-solo test::' |
| 468 'solo group nested non-solo group in solo' |
| 469 ' group nested non-solo group solo test::' |
| 470 'final') |
| 407 }; | 471 }; |
| 408 | 472 |
| 409 tests.forEach((String name, String expected) { | 473 tests.forEach((String name, String expected) { |
| 410 test(name, () => spawnFunction(runTest) | 474 test(name, () => spawnFunction(runTest) |
| 411 .call(name) | 475 .call(name) |
| 412 .then((String msg) => expect(msg.trim(), equals(expected)))); | 476 .then((String msg) => expect(msg.trim(), equals(expected)))); |
| 413 }); | 477 }); |
| 414 } | 478 } |
| 415 | 479 |
| OLD | NEW |