| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * This is a helper for run.sh. We try to run all of the Dart code in one | 6 * This is a helper for run.sh. We try to run all of the Dart code in one |
| 7 * instance of the Dart VM to reduce warm-up time. | 7 * instance of the Dart VM to reduce warm-up time. |
| 8 */ | 8 */ |
| 9 library run_impl; | 9 library run_impl; |
| 10 | 10 |
| 11 import 'dart:io'; | 11 import 'dart:io'; |
| 12 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
| 13 import 'package:unittest/vm_config.dart'; | 13 import 'package:unittest/vm_config.dart'; |
| 14 import 'package:web_components/dwc.dart' as dwc; | 14 import 'package:web_components/dwc.dart' as dwc; |
| 15 import 'analyzer_test.dart' as analyzer_test; | 15 import 'analyzer_test.dart' as analyzer_test; |
| 16 import 'emitter_test.dart' as emitter_test; | 16 import 'emitter_test.dart' as emitter_test; |
| 17 import 'utils_test.dart' as utils_test; | 17 import 'utils_test.dart' as utils_test; |
| 18 import 'watcher_test.dart' as watcher_test; | 18 import 'watcher_test.dart' as watcher_test; |
| 19 import 'directive_parser_test.dart' as directive_test; |
| 19 | 20 |
| 20 // TODO(jmesserly): command line args to filter tests | 21 // TODO(jmesserly): command line args to filter tests |
| 21 main() { | 22 main() { |
| 22 var args = new Options().arguments; | 23 var args = new Options().arguments; |
| 23 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); | 24 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); |
| 24 | 25 |
| 25 useVmConfiguration(); | 26 useVmConfiguration(); |
| 26 | 27 |
| 27 if (pattern.hasMatch('analyzer_test.dart')) analyzer_test.main(); | 28 if (pattern.hasMatch('analyzer_test.dart')) analyzer_test.main(); |
| 28 if (pattern.hasMatch('emitter_test.dart')) emitter_test.main(); | 29 if (pattern.hasMatch('emitter_test.dart')) emitter_test.main(); |
| 29 if (pattern.hasMatch('utils_test.dart')) utils_test.main(); | 30 if (pattern.hasMatch('utils_test.dart')) utils_test.main(); |
| 30 if (pattern.hasMatch('watcher_test.dart')) watcher_test.main(); | 31 if (pattern.hasMatch('watcher_test.dart')) watcher_test.main(); |
| 32 if (pattern.hasMatch('directive_parser_test.dart')) directive_test.main(); |
| 31 | 33 |
| 32 // TODO(jmesserly): should have listSync for scripting... | 34 // TODO(jmesserly): should have listSync for scripting... |
| 33 var lister = new Directory.fromPath(new Path('data/input')).list(); | 35 var lister = new Directory.fromPath(new Path('data/input')).list(); |
| 34 lister.onFile = (path) { | 36 lister.onFile = (path) { |
| 35 if (!path.endsWith('_test.html') || !pattern.hasMatch(path)) return; | 37 if (!path.endsWith('_test.html') || !pattern.hasMatch(path)) return; |
| 36 | 38 |
| 37 test(path, () { | 39 test(path, () { |
| 38 expect(dwc.run(['--verbose', path, 'data/output/']).transform((_) { | 40 expect(dwc.run(['--verbose', path, 'data/output/']).transform((_) { |
| 39 // add empty line for formatting | 41 // add empty line for formatting |
| 40 print(''); | 42 print(''); |
| 41 }), completes); | 43 }), completes); |
| 42 }); | 44 }); |
| 43 }; | 45 }; |
| 44 } | 46 } |
| OLD | NEW |