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 unittest; | 5 library unittest; |
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 17 matching lines...) Expand all Loading... |
28 export 'src/frontend/throws_matchers.dart'; | 28 export 'src/frontend/throws_matchers.dart'; |
29 | 29 |
30 /// The global declarer. | 30 /// The global declarer. |
31 /// | 31 /// |
32 /// This is used if a test file is run directly, rather than through the runner. | 32 /// This is used if a test file is run directly, rather than through the runner. |
33 Declarer _globalDeclarer; | 33 Declarer _globalDeclarer; |
34 | 34 |
35 /// Gets the declarer for the current scope. | 35 /// Gets the declarer for the current scope. |
36 /// | 36 /// |
37 /// When using the runner, this returns the [Zone]-scoped declarer that's set by | 37 /// When using the runner, this returns the [Zone]-scoped declarer that's set by |
38 /// [VmListener]. If the test file is run directly, this returns | 38 /// [IsolateListener] or [IframeListener]. If the test file is run directly, |
39 /// [_globalDeclarer] (and sets it up on the first call). | 39 /// this returns [_globalDeclarer] (and sets it up on the first call). |
40 Declarer get _declarer { | 40 Declarer get _declarer { |
41 var declarer = Zone.current[#unittest.declarer]; | 41 var declarer = Zone.current[#unittest.declarer]; |
42 if (declarer != null) return declarer; | 42 if (declarer != null) return declarer; |
43 if (_globalDeclarer != null) return _globalDeclarer; | 43 if (_globalDeclarer != null) return _globalDeclarer; |
44 | 44 |
45 // Since there's no Zone-scoped declarer, the test file is being run directly. | 45 // Since there's no Zone-scoped declarer, the test file is being run directly. |
46 // In order to run the tests, we set up our own Declarer via | 46 // In order to run the tests, we set up our own Declarer via |
47 // [_globalDeclarer], and schedule a microtask to run the tests once they're | 47 // [_globalDeclarer], and schedule a microtask to run the tests once they're |
48 // finished being defined. | 48 // finished being defined. |
49 _globalDeclarer = new Declarer(); | 49 _globalDeclarer = new Declarer(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void setSoloTest(int id) {} | 141 void setSoloTest(int id) {} |
142 | 142 |
143 @deprecated | 143 @deprecated |
144 void enableTest(int id) {} | 144 void enableTest(int id) {} |
145 | 145 |
146 @deprecated | 146 @deprecated |
147 void disableTest(int id) {} | 147 void disableTest(int id) {} |
148 | 148 |
149 @deprecated | 149 @deprecated |
150 withTestEnvironment(callback()) => callback(); | 150 withTestEnvironment(callback()) => callback(); |
OLD | NEW |