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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 | 8 |
9 import 'src/backend/declarer.dart'; | 9 import 'src/backend/declarer.dart'; |
10 import 'src/backend/test_platform.dart'; | 10 import 'src/backend/test_platform.dart'; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 os: currentOSGuess); | 58 os: currentOSGuess); |
59 | 59 |
60 var engine = new Engine(); | 60 var engine = new Engine(); |
61 engine.suiteSink.add(suite); | 61 engine.suiteSink.add(suite); |
62 engine.suiteSink.close(); | 62 engine.suiteSink.close(); |
63 ExpandedReporter.watch(engine, | 63 ExpandedReporter.watch(engine, |
64 color: true, printPath: false, printPlatform: false); | 64 color: true, printPath: false, printPlatform: false); |
65 | 65 |
66 var success = await engine.run(); | 66 var success = await engine.run(); |
67 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. | 67 // TODO(nweiz): Set the exit code on the VM when issue 6943 is fixed. |
68 if (success) return; | 68 if (success) return null; |
69 print(''); | 69 print(''); |
70 new Future.error("Dummy exception to set exit code."); | 70 new Future.error("Dummy exception to set exit code."); |
71 }); | 71 }); |
72 return _globalDeclarer; | 72 return _globalDeclarer; |
73 } | 73 } |
74 | 74 |
75 // TODO(nweiz): This and other top-level functions should throw exceptions if | 75 // TODO(nweiz): This and other top-level functions should throw exceptions if |
76 // they're called after the declarer has finished declaring. | 76 // they're called after the declarer has finished declaring. |
77 /// Creates a new test case with the given description (converted to a string) | 77 /// Creates a new test case with the given description (converted to a string) |
78 /// and body. | 78 /// and body. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 /// prefer [tearDown], and only use [tearDOwnAll] if the callback is | 240 /// prefer [tearDown], and only use [tearDOwnAll] if the callback is |
241 /// prohibitively slow. | 241 /// prohibitively slow. |
242 void tearDownAll(callback()) => _declarer.tearDownAll(callback); | 242 void tearDownAll(callback()) => _declarer.tearDownAll(callback); |
243 | 243 |
244 /// Registers an exception that was caught for the current test. | 244 /// Registers an exception that was caught for the current test. |
245 void registerException(error, [StackTrace stackTrace]) { | 245 void registerException(error, [StackTrace stackTrace]) { |
246 // This will usually forward directly to [Invoker.current.handleError], but | 246 // This will usually forward directly to [Invoker.current.handleError], but |
247 // going through the zone API allows other zones to consistently see errors. | 247 // going through the zone API allows other zones to consistently see errors. |
248 Zone.current.handleUncaughtError(error, stackTrace); | 248 Zone.current.handleUncaughtError(error, stackTrace); |
249 } | 249 } |
OLD | NEW |