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 30 matching lines...) Expand all Loading... |
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(); |
50 scheduleMicrotask(() { | 50 scheduleMicrotask(() { |
51 var suite = new Suite(p.prettyUri(Uri.base), _globalDeclarer.tests); | 51 var suite = new Suite(_globalDeclarer.tests, |
| 52 path: p.prettyUri(Uri.base), |
| 53 platform: "VM"); |
52 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. | 54 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. |
53 new NoIoCompactReporter([suite], color: true).run(); | 55 new NoIoCompactReporter([suite], color: true).run(); |
54 }); | 56 }); |
55 return _globalDeclarer; | 57 return _globalDeclarer; |
56 } | 58 } |
57 | 59 |
58 // TODO(nweiz): This and other top-level functions should throw exceptions if | 60 // TODO(nweiz): This and other top-level functions should throw exceptions if |
59 // they're called after the declarer has finished declaring. | 61 // they're called after the declarer has finished declaring. |
60 void test(String description, body()) => _declarer.test(description, body); | 62 void test(String description, body()) => _declarer.test(description, body); |
61 | 63 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void setSoloTest(int id) {} | 143 void setSoloTest(int id) {} |
142 | 144 |
143 @deprecated | 145 @deprecated |
144 void enableTest(int id) {} | 146 void enableTest(int id) {} |
145 | 147 |
146 @deprecated | 148 @deprecated |
147 void disableTest(int id) {} | 149 void disableTest(int id) {} |
148 | 150 |
149 @deprecated | 151 @deprecated |
150 withTestEnvironment(callback()) => callback(); | 152 withTestEnvironment(callback()) => callback(); |
OLD | NEW |