OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /** |
| 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. |
| 8 */ |
| 9 library run_impl; |
| 10 |
| 11 import 'dart:io'; |
| 12 import 'package:unittest/compact_vm_config.dart'; |
| 13 import 'package:unittest/unittest.dart'; |
| 14 import 'package:polymer/testing/content_shell_test.dart'; |
| 15 |
| 16 import 'css_test.dart' as css_test; |
| 17 import 'compiler_test.dart' as compiler_test; |
| 18 import 'paths_test.dart' as paths_test; |
| 19 import 'utils_test.dart' as utils_test; |
| 20 |
| 21 main() { |
| 22 var args = new Options().arguments; |
| 23 var pattern = new RegExp(args.length > 0 ? args[0] : '.'); |
| 24 |
| 25 useCompactVMConfiguration(); |
| 26 |
| 27 void addGroup(testFile, testMain) { |
| 28 if (pattern.hasMatch(testFile)) { |
| 29 group(testFile.replaceAll('_test.dart', ':'), testMain); |
| 30 } |
| 31 } |
| 32 |
| 33 addGroup('compiler_test.dart', compiler_test.main); |
| 34 addGroup('css_test.dart', css_test.main); |
| 35 addGroup('paths_test.dart', paths_test.main); |
| 36 addGroup('utils_test.dart', utils_test.main); |
| 37 |
| 38 endToEndTests('data/unit/', 'data/out'); |
| 39 |
| 40 // Note: if you're adding more render test suites, make sure to update run.sh |
| 41 // as well for convenient baseline diff/updating. |
| 42 |
| 43 // TODO(jmesserly): figure out why this fails in content_shell but works in |
| 44 // Dartium and Firefox when using the ShadowDOM polyfill. |
| 45 exampleTest('../example/component/news', ['--no-shadowdom']..addAll(args)); |
| 46 |
| 47 exampleTest('../../../samples/third_party/todomvc'); |
| 48 } |
| 49 |
| 50 void exampleTest(String path, [List<String> args]) { |
| 51 renderTests(path, '$path/test', '$path/test/expected', '$path/test/out', |
| 52 arguments: args); |
| 53 } |
| 54 |
| 55 void cssCompileMangleTest(String path, String pattern, |
| 56 [bool deleteDirectory = true]) { |
| 57 renderTests(path, path, '$path/expected', '$path/out', |
| 58 arguments: ['--css-mangle'], pattern: pattern, |
| 59 deleteDir: deleteDirectory); |
| 60 } |
| 61 |
| 62 void cssCompilePolyFillTest(String path, String pattern, String cssReset, |
| 63 [bool deleteDirectory = true]) { |
| 64 var args = ['--no-css-mangle']; |
| 65 if (cssReset != null) { |
| 66 args.addAll(['--css-reset', '${path}/${cssReset}']); |
| 67 } |
| 68 renderTests(path, path, '$path/expected', '$path/out', |
| 69 arguments: args, pattern: pattern, deleteDir: deleteDirectory); |
| 70 } |
| 71 |
| 72 void cssCompileShadowDOMTest(String path, String pattern, |
| 73 [bool deleteDirectory = true]) { |
| 74 var args = ['--no-css']; |
| 75 renderTests(path, path, '$path/expected', '$path/out', |
| 76 arguments: args, pattern: pattern, |
| 77 deleteDir: deleteDirectory); |
| 78 } |
OLD | NEW |