| 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/compact_vm_config.dart'; | 12 import 'package:unittest/compact_vm_config.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 14 import 'package:polymer/testing/content_shell_test.dart'; | |
| 15 | 14 |
| 16 import 'compiler_test.dart' as compiler_test; | |
| 17 import 'css_test.dart' as css_test; | |
| 18 import 'transform/all_phases_test.dart' as all_phases_test; | 15 import 'transform/all_phases_test.dart' as all_phases_test; |
| 19 import 'transform/code_extractor_test.dart' as code_extractor_test; | 16 import 'transform/code_extractor_test.dart' as code_extractor_test; |
| 20 import 'transform/import_inliner_test.dart' as import_inliner_test; | 17 import 'transform/import_inliner_test.dart' as import_inliner_test; |
| 21 import 'transform/polyfill_injector_test.dart' as polyfill_injector_test; | 18 import 'transform/polyfill_injector_test.dart' as polyfill_injector_test; |
| 22 import 'transform/script_compactor_test.dart' as script_compactor_test; | 19 import 'transform/script_compactor_test.dart' as script_compactor_test; |
| 23 import 'utils_test.dart' as utils_test; | 20 import 'utils_test.dart' as utils_test; |
| 24 import 'linter_test.dart' as linter_test; | 21 import 'linter_test.dart' as linter_test; |
| 25 | 22 |
| 26 main() { | 23 main() { |
| 27 var args = new Options().arguments; | 24 var args = new Options().arguments; |
| 28 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); | 25 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); |
| 29 | 26 |
| 30 useCompactVMConfiguration(); | 27 useCompactVMConfiguration(); |
| 31 | 28 |
| 32 void addGroup(testFile, testMain) { | 29 void addGroup(testFile, testMain) { |
| 33 if (pattern.hasMatch(testFile)) { | 30 if (pattern.hasMatch(testFile)) { |
| 34 group(testFile.replaceAll('_test.dart', ':'), testMain); | 31 group(testFile.replaceAll('_test.dart', ':'), testMain); |
| 35 } | 32 } |
| 36 } | 33 } |
| 37 | 34 |
| 38 addGroup('linter_test.dart', linter_test.main); | 35 addGroup('linter_test.dart', linter_test.main); |
| 39 addGroup('compiler_test.dart', compiler_test.main); | |
| 40 addGroup('css_test.dart', css_test.main); | |
| 41 addGroup('utils_test.dart', utils_test.main); | 36 addGroup('utils_test.dart', utils_test.main); |
| 42 addGroup('transform/code_extractor_test.dart', code_extractor_test.main); | 37 addGroup('transform/code_extractor_test.dart', code_extractor_test.main); |
| 43 addGroup('transform/import_inliner_test.dart', import_inliner_test.main); | 38 addGroup('transform/import_inliner_test.dart', import_inliner_test.main); |
| 44 addGroup('transform/script_compactor_test.dart', script_compactor_test.main); | 39 addGroup('transform/script_compactor_test.dart', script_compactor_test.main); |
| 45 addGroup('transform/polyfill_injector_test.dart', | 40 addGroup('transform/polyfill_injector_test.dart', |
| 46 polyfill_injector_test.main); | 41 polyfill_injector_test.main); |
| 47 addGroup('transform/all_phases_test.dart', all_phases_test.main); | 42 addGroup('transform/all_phases_test.dart', all_phases_test.main); |
| 48 | |
| 49 endToEndTests('data/unit/web', 'data/out'); | |
| 50 | |
| 51 // Note: if you're adding more render test suites, make sure to update run.sh | |
| 52 // as well for convenient baseline diff/updating. | |
| 53 | |
| 54 // TODO(jmesserly): figure out why this fails in content_shell but works in | |
| 55 // Dartium and Firefox when using the ShadowDOM polyfill. | |
| 56 exampleTest('../example/component/news', ['--no-shadowdom']..addAll(args)); | |
| 57 } | 43 } |
| 58 | |
| 59 void exampleTest(String path, [List args]) { | |
| 60 // TODO(sigmund): renderTests currently contatenates [path] with the out | |
| 61 // folder. This can be a problem with relative paths that go up (like todomvc | |
| 62 // above, which has '../../../'). If we continue running tests with | |
| 63 // test/run.sh, we should fix this. For now we work around this problem by | |
| 64 // using a long path 'data/out/example/test'. That way we avoid dumping output | |
| 65 // in the source-tree. | |
| 66 renderTests(path, '$path/test', '$path/test/expected', | |
| 67 'data/out/example/test', arguments: args); | |
| 68 } | |
| OLD | NEW |