OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
9 | 9 |
10 import 'package:scheduled_test/descriptor.dart' as d; | 10 import 'package:scheduled_test/descriptor.dart' as d; |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 test.shouldExit(0); | 395 test.shouldExit(0); |
396 }); | 396 }); |
397 | 397 |
398 test("respects matching Timeouts", () { | 398 test("respects matching Timeouts", () { |
399 d.file("test.dart", ''' | 399 d.file("test.dart", ''' |
400 import 'dart:async'; | 400 import 'dart:async'; |
401 | 401 |
402 import 'package:test/test.dart'; | 402 import 'package:test/test.dart'; |
403 | 403 |
404 void main() { | 404 void main() { |
405 test("fail", () => throw 'oh no', onPlatform: { | 405 test("fail", () async { |
406 "vm": new Timeout(new Duration(seconds: 0)) | 406 await new Future.delayed(Duration.ZERO); |
| 407 throw 'oh no'; |
| 408 }, onPlatform: { |
| 409 "vm": new Timeout(Duration.ZERO) |
407 }); | 410 }); |
408 } | 411 } |
409 ''').create(); | 412 ''').create(); |
410 | 413 |
411 var test = runTest(["test.dart"]); | 414 var test = runTest(["test.dart"]); |
412 test.stdout.expect(containsInOrder([ | 415 test.stdout.expect(containsInOrder([ |
413 "Test timed out after 0 seconds.", | 416 "Test timed out after 0 seconds.", |
414 "-1: Some tests failed." | 417 "-1: Some tests failed." |
415 ])); | 418 ])); |
416 test.shouldExit(1); | 419 test.shouldExit(1); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 d.file("test.dart", ''' | 505 d.file("test.dart", ''' |
503 @OnPlatform(const { | 506 @OnPlatform(const { |
504 "vm": const Timeout(const Duration(seconds: 0)) | 507 "vm": const Timeout(const Duration(seconds: 0)) |
505 }) | 508 }) |
506 | 509 |
507 import 'dart:async'; | 510 import 'dart:async'; |
508 | 511 |
509 import 'package:test/test.dart'; | 512 import 'package:test/test.dart'; |
510 | 513 |
511 void main() { | 514 void main() { |
512 test("fail", () => throw 'oh no'); | 515 test("fail", () async { |
| 516 await new Future.delayed(Duration.ZERO); |
| 517 throw 'oh no'; |
| 518 }); |
513 } | 519 } |
514 ''').create(); | 520 ''').create(); |
515 | 521 |
516 var test = runTest(["test.dart"]); | 522 var test = runTest(["test.dart"]); |
517 test.stdout.expect(containsInOrder([ | 523 test.stdout.expect(containsInOrder([ |
518 "Test timed out after 0 seconds.", | 524 "Test timed out after 0 seconds.", |
519 "-1: Some tests failed." | 525 "-1: Some tests failed." |
520 ])); | 526 ])); |
521 test.shouldExit(1); | 527 test.shouldExit(1); |
522 }); | 528 }); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 d.file("test.dart", _success).create(); | 654 d.file("test.dart", _success).create(); |
649 | 655 |
650 var test = runTest(["--plain-name", "no match", "test.dart"]); | 656 var test = runTest(["--plain-name", "no match", "test.dart"]); |
651 test.stderr.expect( | 657 test.stderr.expect( |
652 consumeThrough(contains('No tests match "no match".'))); | 658 consumeThrough(contains('No tests match "no match".'))); |
653 test.shouldExit(exit_codes.data); | 659 test.shouldExit(exit_codes.data); |
654 }); | 660 }); |
655 }); | 661 }); |
656 }); | 662 }); |
657 } | 663 } |
OLD | NEW |