Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/bash | |
| 2 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 3 # for details. All rights reserved. Use of this source code is governed by a | |
| 4 # BSD-style license that can be found in the LICENSE file. | |
| 5 | |
| 6 # bail on error | |
| 7 set -e | |
| 8 | |
| 9 generate_test_files() { | |
| 10 pushd angular/test > /dev/null | |
| 11 | |
| 12 local out_dir='../../../../pkg/third_party/angular_tests' | |
| 13 | |
| 14 generate_browser_tests | |
| 15 generate_vm_tests | |
| 16 popd > /dev/null | |
| 17 } | |
| 18 | |
| 19 generate_browser_tests() { | |
| 20 local test_file="${out_dir}/browser_test.dart" | |
| 21 local tests=$(find * -name "*_spec.dart" \ | |
| 22 -not -path "playback/*" \ | |
| 23 -not -path "io/*" \ | |
| 24 -not -path "tools/*" \ | |
| 25 -not -path "*/generated_parser_spec.dart") | |
| 26 | |
| 27 mkdir -p "${out_dir}" | |
| 28 cat << END_HEADER > "${test_file}" | |
|
Siggi Cherem (dart-lang)
2014/01/10 20:50:56
consider creating a folder with these template pie
| |
| 29 /// auto-generated by update_angular.sh | |
| 30 | |
| 31 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 32 // for details. All rights reserved. Use of this source code is governed by a | |
| 33 // BSD-style license that can be found in the LICENSE file. | |
| 34 | |
| 35 library angular_browser_tests; | |
| 36 | |
| 37 import 'package:angular/mock/module.dart'; | |
| 38 import 'package:unittest/html_individual_config.dart'; | |
| 39 import 'package:unittest/unittest.dart'; | |
| 40 | |
| 41 END_HEADER | |
| 42 | |
| 43 local index=0 | |
| 44 for src_file in ${tests}; do | |
| 45 local import_file="../../../third_party/pkg/angular/test/${src_file}" | |
| 46 echo "import '${import_file}' as test_${index};" >> "${test_file}" | |
|
Siggi Cherem (dart-lang)
2014/01/10 20:50:56
you should be able to leave out the "" here (simil
| |
| 47 index=$(expr ${index} + 1) | |
| 48 done | |
| 49 | |
| 50 cat << END_START_MAIN >> "${test_file}" | |
| 51 | |
| 52 main() { | |
| 53 useHtmlIndividualConfiguration(); | |
| 54 | |
| 55 setUp(() { | |
| 56 setUpInjector(); | |
| 57 }); | |
| 58 | |
| 59 END_START_MAIN | |
| 60 | |
| 61 index=0 | |
| 62 for src_file in ${tests}; do | |
| 63 cat << END_TEST_BODY >> "${test_file}" | |
| 64 group('${src_file%_spec.dart}', () { | |
| 65 test_${index}.main(); | |
| 66 }); | |
| 67 | |
| 68 END_TEST_BODY | |
| 69 index=$(expr ${index} + 1) | |
| 70 done | |
| 71 echo "}" >> "${test_file}" | |
| 72 } | |
| 73 | |
| 74 generate_vm_tests() { | |
| 75 local test_file="${out_dir}/vm_test.dart" | |
| 76 local tests=$(find tools -name "*_spec.dart") | |
| 77 | |
| 78 mkdir -p "${out_dir}" | |
| 79 cat << END_HEADER > "${test_file}" | |
| 80 /// auto-generated by update_angular.sh | |
| 81 | |
| 82 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 83 // for details. All rights reserved. Use of this source code is governed by a | |
| 84 // BSD-style license that can be found in the LICENSE file. | |
| 85 | |
| 86 library angular_vm_tests; | |
| 87 | |
| 88 import 'package:unittest/compact_vm_config.dart'; | |
| 89 import 'package:unittest/unittest.dart'; | |
| 90 | |
| 91 END_HEADER | |
| 92 | |
| 93 local index=0 | |
| 94 for src_file in ${tests}; do | |
| 95 local import_file="../../../third_party/pkg/angular/test/${src_file}" | |
| 96 echo "import '${import_file}' as test_${index};" >> "${test_file}" | |
| 97 index=$(expr ${index} + 1) | |
| 98 done | |
| 99 | |
| 100 cat << END_START_MAIN >> "${test_file}" | |
| 101 | |
| 102 main() { | |
| 103 useCompactVMConfiguration(); | |
| 104 | |
| 105 END_START_MAIN | |
| 106 | |
| 107 index=0 | |
| 108 for src_file in ${tests}; do | |
| 109 cat << END_TEST_BODY >> "${test_file}" | |
| 110 group('${src_file%_spec.dart}', () { | |
| 111 test_${index}.main(); | |
| 112 }); | |
| 113 | |
| 114 END_TEST_BODY | |
| 115 index=$(expr ${index} + 1) | |
| 116 done | |
| 117 echo "}" >> "${test_file}" | |
| 118 } | |
| 119 | |
| 120 generate_test_files | |
| OLD | NEW |