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/suite.dart'; | |
13 import 'src/backend/test_platform.dart'; | 12 import 'src/backend/test_platform.dart'; |
14 import 'src/frontend/timeout.dart'; | 13 import 'src/frontend/timeout.dart'; |
15 import 'src/runner/engine.dart'; | 14 import 'src/runner/engine.dart'; |
16 import 'src/runner/reporter/expanded.dart'; | 15 import 'src/runner/reporter/expanded.dart'; |
| 16 import 'src/runner/runner_suite.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 16 matching lines...) Expand all Loading... |
43 var declarer = Zone.current[#test.declarer]; | 43 var declarer = Zone.current[#test.declarer]; |
44 if (declarer != null) return declarer; | 44 if (declarer != null) return declarer; |
45 if (_globalDeclarer != null) return _globalDeclarer; | 45 if (_globalDeclarer != null) return _globalDeclarer; |
46 | 46 |
47 // Since there's no Zone-scoped declarer, the test file is being run directly. | 47 // Since there's no Zone-scoped declarer, the test file is being run directly. |
48 // In order to run the tests, we set up our own Declarer via | 48 // In order to run the tests, we set up our own Declarer via |
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(() async { | 52 scheduleMicrotask(() async { |
53 var suite = new Suite( | 53 var suite = new RunnerSuite( |
54 _globalDeclarer.tests, | 54 _globalDeclarer.tests, |
55 path: p.prettyUri(Uri.base), | 55 path: p.prettyUri(Uri.base), |
56 platform: TestPlatform.vm, | 56 platform: TestPlatform.vm, |
57 os: currentOSGuess); | 57 os: currentOSGuess); |
58 | 58 |
59 var engine = new Engine(); | 59 var engine = new Engine(); |
60 engine.suiteSink.add(suite); | 60 engine.suiteSink.add(suite); |
61 engine.suiteSink.close(); | 61 engine.suiteSink.close(); |
62 ExpandedReporter.watch(engine, | 62 ExpandedReporter.watch(engine, |
63 color: true, printPath: false, printPlatform: false); | 63 color: true, printPath: false, printPlatform: false); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 /// group. [callback] will be run before any tear-down callbacks in parent | 176 /// group. [callback] will be run before any tear-down callbacks in parent |
177 /// groups or at the top level. | 177 /// groups or at the top level. |
178 void tearDown(callback()) => _declarer.tearDown(callback); | 178 void tearDown(callback()) => _declarer.tearDown(callback); |
179 | 179 |
180 /// Registers an exception that was caught for the current test. | 180 /// Registers an exception that was caught for the current test. |
181 void registerException(error, [StackTrace stackTrace]) { | 181 void registerException(error, [StackTrace stackTrace]) { |
182 // This will usually forward directly to [Invoker.current.handleError], but | 182 // This will usually forward directly to [Invoker.current.handleError], but |
183 // going through the zone API allows other zones to consistently see errors. | 183 // going through the zone API allows other zones to consistently see errors. |
184 Zone.current.handleUncaughtError(error, stackTrace); | 184 Zone.current.handleUncaughtError(error, stackTrace); |
185 } | 185 } |
OLD | NEW |