| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.batch_util; | 4 library kernel.batch_util; |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 enum CompilerOutcome { Ok, Fail, } | 10 enum CompilerOutcome { |
| 11 Ok, |
| 12 Fail, |
| 13 } |
| 11 | 14 |
| 12 typedef Future<CompilerOutcome> BatchCallback(List<String> arguments); | 15 typedef Future<CompilerOutcome> BatchCallback(List<String> arguments); |
| 13 | 16 |
| 14 /// Runs the given [callback] in the batch mode for use by the test framework in | 17 /// Runs the given [callback] in the batch mode for use by the test framework in |
| 15 /// `dart-lang/sdk`. | 18 /// `dart-lang/sdk`. |
| 16 /// | 19 /// |
| 17 /// The [callback] should behave as a main method, except it should return a | 20 /// The [callback] should behave as a main method, except it should return a |
| 18 /// [CompilerOutcome] for reporting its outcome to the testing framework. | 21 /// [CompilerOutcome] for reporting its outcome to the testing framework. |
| 19 Future runBatch(BatchCallback callback) async { | 22 Future runBatch(BatchCallback callback) async { |
| 20 int totalTests = 0; | 23 int totalTests = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 print('>>> TEST FAIL ${watch.elapsedMilliseconds}ms'); | 43 print('>>> TEST FAIL ${watch.elapsedMilliseconds}ms'); |
| 41 } | 44 } |
| 42 } catch (e, stackTrace) { | 45 } catch (e, stackTrace) { |
| 43 stderr.writeln(e); | 46 stderr.writeln(e); |
| 44 stderr.writeln(stackTrace); | 47 stderr.writeln(stackTrace); |
| 45 stderr.writeln('>>> EOF STDERR'); | 48 stderr.writeln('>>> EOF STDERR'); |
| 46 print('>>> TEST CRASH'); | 49 print('>>> TEST CRASH'); |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 } | 52 } |
| OLD | NEW |