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 test; | 5 library test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 | 10 |
11 import 'src/backend/declarer.dart'; | 11 import 'src/backend/declarer.dart'; |
12 import 'src/backend/invoker.dart'; | 12 import 'src/backend/invoker.dart'; |
13 import 'src/backend/suite.dart'; | 13 import 'src/backend/suite.dart'; |
14 import 'src/backend/test_platform.dart'; | 14 import 'src/backend/test_platform.dart'; |
15 import 'src/frontend/timeout.dart'; | 15 import 'src/frontend/timeout.dart'; |
16 import 'src/runner/reporter/no_io_compact.dart'; | 16 import 'src/runner/reporter/expanded.dart'; |
17 import 'src/utils.dart'; | 17 import 'src/utils.dart'; |
18 | 18 |
19 export 'package:matcher/matcher.dart'; | 19 export 'package:matcher/matcher.dart'; |
20 | 20 |
21 export 'src/frontend/expect.dart'; | 21 export 'src/frontend/expect.dart'; |
22 export 'src/frontend/expect_async.dart'; | 22 export 'src/frontend/expect_async.dart'; |
23 export 'src/frontend/future_matchers.dart'; | 23 export 'src/frontend/future_matchers.dart'; |
24 export 'src/frontend/on_platform.dart'; | 24 export 'src/frontend/on_platform.dart'; |
25 export 'src/frontend/prints_matcher.dart'; | 25 export 'src/frontend/prints_matcher.dart'; |
26 export 'src/frontend/skip.dart'; | 26 export 'src/frontend/skip.dart'; |
(...skipping 22 matching lines...) Expand all Loading... |
49 // [_globalDeclarer], and schedule a microtask to run the tests once they're | 49 // [_globalDeclarer], and schedule a microtask to run the tests once they're |
50 // finished being defined. | 50 // finished being defined. |
51 _globalDeclarer = new Declarer(); | 51 _globalDeclarer = new Declarer(); |
52 scheduleMicrotask(() { | 52 scheduleMicrotask(() { |
53 var suite = | 53 var suite = |
54 new Suite(_globalDeclarer.tests, | 54 new Suite(_globalDeclarer.tests, |
55 path: p.prettyUri(Uri.base), | 55 path: p.prettyUri(Uri.base), |
56 platform: "VM") | 56 platform: "VM") |
57 .forPlatform(TestPlatform.vm, os: currentOSGuess); | 57 .forPlatform(TestPlatform.vm, os: currentOSGuess); |
58 | 58 |
59 new NoIoCompactReporter([suite], color: true).run().then((success) { | 59 new ExpandedReporter([suite], color: true).run().then((success) { |
60 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. | 60 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. |
61 if (success) return; | 61 if (success) return; |
62 print(''); | 62 print(''); |
63 new Future.error("Dummy exception to set exit code."); | 63 new Future.error("Dummy exception to set exit code."); |
64 }); | 64 }); |
65 }); | 65 }); |
66 return _globalDeclarer; | 66 return _globalDeclarer; |
67 } | 67 } |
68 | 68 |
69 // TODO(nweiz): This and other top-level functions should throw exceptions if | 69 // TODO(nweiz): This and other top-level functions should throw exceptions if |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 /// Handle an error that occurs outside of any test. | 175 /// Handle an error that occurs outside of any test. |
176 void handleExternalError(error, String message, [stackTrace]) { | 176 void handleExternalError(error, String message, [stackTrace]) { |
177 // TODO(nweiz): handle this better. | 177 // TODO(nweiz): handle this better. |
178 registerException(error, stackTrace); | 178 registerException(error, stackTrace); |
179 } | 179 } |
180 | 180 |
181 /// Registers an exception that was caught for the current test. | 181 /// Registers an exception that was caught for the current test. |
182 void registerException(error, [StackTrace stackTrace]) => | 182 void registerException(error, [StackTrace stackTrace]) => |
183 Invoker.current.handleError(error, stackTrace); | 183 Invoker.current.handleError(error, stackTrace); |
OLD | NEW |