Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/bash | |
| 2 # Copyright (c) 2013, 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 source update.sh | |
| 10 | |
| 11 generate_test_files() { | |
| 12 pushd angular/test > /dev/null | |
| 13 | |
| 14 local test_files=$(find * -name "*_spec.dart" \ | |
| 15 -not -path "playback/*" \ | |
| 16 -not -path "io/*" \ | |
| 17 -not -path "*/generated_parser_spec.dart") | |
| 18 local out_dir='../../../../pkg/third_party/angular_tests' | |
| 19 rm -rf "${out_dir}" | |
| 20 | |
| 21 for src_file in ${test_files}; do | |
| 22 local test_dir=$(dirname ${src_file}) | |
| 23 mkdir -p "${out_dir}/${test_dir}" | |
| 24 local out_file="${out_dir}/${src_file}" | |
| 25 local out_file="${out_file%spec.dart}test.dart" | |
| 26 local import_file="$(echo "$(dirname "./${src_file}")/" \ | |
|
Siggi Cherem (dart-lang)
2014/01/04 01:16:38
would it work here to just use echo $test_dir ?
| |
| 27 | sed -e "s/[^\/]\+/../g")" | |
| 28 import_file="${import_file}../../third_party/pkg/angular/test/${src_file}" | |
| 29 | |
| 30 if [[ "${src_file}}" =~ tools/* ]]; then | |
| 31 generate_vm_test ${import_file} ${out_file} | |
| 32 else | |
| 33 generate_browser_test ${import_file} ${out_file} | |
| 34 fi | |
| 35 done | |
| 36 popd > /dev/null | |
| 37 } | |
| 38 | |
| 39 generate_browser_test() { | |
| 40 local import_file=$1 | |
| 41 local out_file=$2 | |
| 42 | |
| 43 cat << END_TEMPLATE > ${out_file} | |
| 44 /// auto-generated by generate_angular_tests.sh | |
| 45 | |
| 46 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 47 // for details. All rights reserved. Use of this source code is governed by a | |
| 48 // BSD-style license that can be found in the LICENSE file. | |
| 49 | |
| 50 library angular_tests; | |
| 51 | |
| 52 import 'package:angular/mock/module.dart'; | |
| 53 import 'package:unittest/html_config.dart'; | |
| 54 import 'package:unittest/unittest.dart'; | |
| 55 import '${import_file}' as test_lib; | |
| 56 | |
| 57 main() { | |
| 58 useHtmlConfiguration(); | |
| 59 | |
| 60 setUp(() { | |
| 61 setUpInjector(); | |
| 62 }); | |
| 63 | |
| 64 test_lib.main(); | |
| 65 } | |
| 66 | |
| 67 END_TEMPLATE | |
| 68 } | |
| 69 | |
| 70 generate_vm_test() { | |
| 71 local import_file=$1 | |
| 72 local out_file=$2 | |
| 73 | |
| 74 cat << END_TEMPLATE > ${out_file} | |
| 75 /// auto-generated by update_angular.sh | |
| 76 | |
| 77 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 78 // for details. All rights reserved. Use of this source code is governed by a | |
| 79 // BSD-style license that can be found in the LICENSE file. | |
| 80 | |
| 81 library angular_tests; | |
| 82 | |
| 83 import 'package:unittest/unittest.dart'; | |
| 84 import 'package:unittest/compact_vm_config.dart'; | |
| 85 import '${import_file}' as test_lib; | |
| 86 | |
| 87 main() { | |
| 88 useCompactVMConfiguration(); | |
| 89 | |
| 90 test_lib.main(); | |
| 91 } | |
| 92 | |
| 93 END_TEMPLATE | |
| 94 } | |
| 95 | |
| 96 update "angular" "https://github.com/angular/angular.dart" | |
| 97 | |
| 98 echo "*** Generating test files" | |
| 99 generate_test_files | |
| OLD | NEW |