OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import '../bin/batch_util.dart'; | |
6 import 'dart:async'; | |
7 | |
8 /// Wraps a main() method for a test that should be runnable as a self-checking | |
9 /// unit test. | |
10 /// | |
11 /// These tests can be run like: | |
12 /// | |
13 /// tools/test.py -cdartk -rself_check | |
14 /// | |
15 /// The test can either be run with a single file passed on the command line | |
16 /// or run in batch mode. | |
17 runSelfCheck(List<String> args, runTest(String filename)) { | |
18 Future<CompilerOutcome> batchMain(List<String> arguments) async { | |
19 if (arguments.length != 1) { | |
20 throw 'Exactly one argument expected'; | |
21 } | |
22 String filename = arguments[0]; | |
23 if (!filename.endsWith('.dill')) { | |
24 throw 'File does not have expected .dill extension: $filename'; | |
25 } | |
26 runTest(filename); | |
kustermann
2016/12/06 10:39:05
Maybe document if this [runTest] can ever be async
asgerf
2016/12/06 13:42:08
Good point. I've changed it to be asynchronous.
| |
27 return CompilerOutcome.Ok; | |
28 } | |
29 if (args.length == 1 && args[0] == '--batch') { | |
30 runBatch(batchMain); | |
31 } else { | |
32 batchMain(args); | |
33 } | |
34 } | |
OLD | NEW |