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 unittestTest; | 5 library unittest.late_exception_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'package:metatest/metatest.dart'; |
8 import 'dart:isolate'; | |
9 | |
10 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
11 | 9 |
12 part 'utils.dart'; | 10 import 'utils.dart'; |
13 | 11 |
14 var testName = 'late exception test'; | 12 void main() => initTests(_test); |
15 | 13 |
16 var testFunction = (_) { | 14 void _test(message) { |
17 var f; | 15 initMetatest(message); |
18 test('testOne', () { | |
19 f = expectAsync(() {}); | |
20 _defer(f); | |
21 }); | |
22 test('testTwo', () { | |
23 _defer(expectAsync(() { f(); })); | |
24 }); | |
25 }; | |
26 | 16 |
27 var expected = buildStatusString(1, 0, 1, 'testOne', | 17 expectTestResults('late exception test', () { |
28 message: 'Callback called (2) after test case testOne has already ' | 18 var f; |
29 'been marked as pass.:testTwo:'); | 19 test('testOne', () { |
| 20 f = expectAsync(() {}); |
| 21 defer(f); |
| 22 }); |
| 23 test('testTwo', () { |
| 24 defer(expectAsync(() { |
| 25 f(); |
| 26 })); |
| 27 }); |
| 28 }, [{ |
| 29 'description': 'testOne', |
| 30 'message': 'Callback called (2) after test case testOne has already been ' |
| 31 'marked as pass.', |
| 32 'result': 'error', |
| 33 }, { |
| 34 'description': 'testTwo', |
| 35 'result': 'pass', |
| 36 }]); |
| 37 } |
OLD | NEW |