| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 = | 53 var suite = new Suite( |
| 54 new Suite(_globalDeclarer.tests, | 54 _globalDeclarer.tests, |
| 55 path: p.prettyUri(Uri.base), | 55 path: p.prettyUri(Uri.base), |
| 56 platform: "VM") | 56 platform: TestPlatform.vm, |
| 57 .forPlatform(TestPlatform.vm, 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); |
| 64 | 64 |
| 65 var success = await engine.run(); | 65 var success = await engine.run(); |
| 66 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. | 66 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. |
| 67 if (success) return; | 67 if (success) return; |
| (...skipping 108 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 |