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 echo "$(browser_header)" > "${test_file}" | |
|
Siggi Cherem (dart-lang)
2014/01/10 23:26:43
I think you can simplify this as:
browser_head
| |
| 29 | |
| 30 local index=0 | |
| 31 for src_file in ${tests}; do | |
| 32 local import_file="../../../third_party/pkg/angular/test/${src_file}" | |
| 33 echo "import '${import_file}' as test_${index};" >> "${test_file}" | |
| 34 index=$(expr ${index} + 1) | |
| 35 done | |
| 36 | |
| 37 echo "$(browser_main)" >> "${test_file}" | |
|
Siggi Cherem (dart-lang)
2014/01/10 23:26:43
same here and below
| |
| 38 | |
| 39 index=0 | |
| 40 for src_file in ${tests}; do | |
| 41 echo "$(test_group)" >> "${test_file}" | |
| 42 index=$(expr ${index} + 1) | |
| 43 done | |
| 44 echo "}" >> "${test_file}" | |
| 45 } | |
| 46 | |
| 47 generate_vm_tests() { | |
| 48 local test_file="${out_dir}/vm_test.dart" | |
| 49 local tests=$(find tools -name "*_spec.dart") | |
| 50 | |
| 51 mkdir -p "${out_dir}" | |
| 52 echo "$(vm_header)" > "${test_file}" | |
| 53 | |
| 54 local index=0 | |
| 55 for src_file in ${tests}; do | |
| 56 local import_file="../../../third_party/pkg/angular/test/${src_file}" | |
| 57 echo "import '${import_file}' as test_${index};" >> "${test_file}" | |
| 58 index=$(expr ${index} + 1) | |
| 59 done | |
| 60 | |
| 61 echo "$(vm_main)" >> "${test_file}" | |
| 62 | |
| 63 index=0 | |
| 64 for src_file in ${tests}; do | |
| 65 echo "$(test_group)" >> "${test_file}" | |
| 66 index=$(expr ${index} + 1) | |
| 67 done | |
| 68 echo "}" >> "${test_file}" | |
| 69 } | |
| 70 | |
| 71 browser_header() { | |
| 72 echo "/// auto-generated by update_angular.sh | |
| 73 | |
| 74 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 75 // for details. All rights reserved. Use of this source code is governed by a | |
| 76 // BSD-style license that can be found in the LICENSE file. | |
| 77 | |
| 78 library angular_browser_tests; | |
| 79 | |
| 80 import 'package:angular/mock/module.dart'; | |
| 81 import 'package:unittest/html_individual_config.dart'; | |
| 82 import 'package:unittest/unittest.dart'; | |
| 83 | |
| 84 " | |
| 85 } | |
| 86 | |
| 87 browser_main() { | |
| 88 echo " | |
| 89 main() { | |
| 90 useHtmlIndividualConfiguration(); | |
| 91 | |
| 92 setUp(() { | |
| 93 setUpInjector(); | |
| 94 }); | |
| 95 " | |
| 96 } | |
| 97 | |
| 98 test_group() { | |
| 99 echo " | |
| 100 group('${src_file%_spec.dart}', () { | |
| 101 test_${index}.main(); | |
| 102 });" | |
| 103 } | |
| 104 | |
| 105 vm_header() { | |
| 106 echo "/// auto-generated by update_angular.sh | |
| 107 | |
| 108 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 109 // for details. All rights reserved. Use of this source code is governed by a | |
| 110 // BSD-style license that can be found in the LICENSE file. | |
| 111 | |
| 112 library angular_vm_tests; | |
| 113 | |
| 114 import 'package:unittest/compact_vm_config.dart'; | |
| 115 import 'package:unittest/unittest.dart'; | |
| 116 | |
| 117 " | |
| 118 } | |
| 119 | |
| 120 vm_main() { | |
| 121 echo " | |
| 122 main() { | |
| 123 useCompactVMConfiguration(); | |
| 124 " | |
| 125 } | |
| 126 | |
| 127 generate_test_files | |
| OLD | NEW |