Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1333)

Side by Side Diff: third_party/pkg/update_angular.sh

Issue 133843003: Merging all Angular tests into a single file (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 # bail on error 6 # bail on error
7 set -e 7 set -e
8 8
9 source update.sh 9 source update.sh
10 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}")/" \
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 local test_name="$(basename $out_file)"
43
44 cat << END_DART_TEMPLATE > ${out_file}
45 /// auto-generated by generate_angular_tests.sh
46
47 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
48 // for details. All rights reserved. Use of this source code is governed by a
49 // BSD-style license that can be found in the LICENSE file.
50
51 library angular_tests;
52
53 import 'package:angular/mock/module.dart';
54 import 'package:unittest/html_config.dart';
55 import 'package:unittest/unittest.dart';
56 import '${import_file}' as test_lib;
57
58 main() {
59 useHtmlConfiguration();
60
61 setUp(() {
62 setUpInjector();
63 });
64
65 test_lib.main();
66 }
67
68 END_DART_TEMPLATE
69
70 cat << END_HTML_TEMPLATE > "${out_file%.dart}.html"
71 <!DOCTYPE html>
72 <html>
73 <head>
74 <meta http-equiv="X-UA-Compatible" content="IE=edge">
75 <meta name="dart.unittest" content="full-stack-traces">
76 <title> ${test_name} </title>
77 <style>
78 .unittest-table { font-family:monospace; border:1px; }
79 .unittest-pass { background: #6b3;}
80 .unittest-fail { background: #d55;}
81 .unittest-error { background: #a11;}
82 </style>
83 <script src="/packages/shadow_dom/shadow_dom.debug.js"></script>
84 </head>
85 <body>
86 <h1> Running ${test_name} </h1>
87 <script type="text/javascript"
88 src="/packages/unittest/test_controller.js"></script>
89 <script type="text/javascript"
90 src="/packages/browser/interop.js"></script>
91 %TEST_SCRIPTS%
92 </body>
93 </html>
94
95 END_HTML_TEMPLATE
96 }
97
98 generate_vm_test() {
99 local import_file=$1
100 local out_file=$2
101
102 cat << END_TEMPLATE > ${out_file}
103 /// auto-generated by update_angular.sh
104
105 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
106 // for details. All rights reserved. Use of this source code is governed by a
107 // BSD-style license that can be found in the LICENSE file.
108
109 library angular_tests;
110
111 import 'package:unittest/unittest.dart';
112 import 'package:unittest/compact_vm_config.dart';
113 import '${import_file}' as test_lib;
114
115 main() {
116 useCompactVMConfiguration();
117
118 test_lib.main();
119 }
120
121 END_TEMPLATE
122 }
123
124 update "angular" "https://github.com/angular/angular.dart" 11 update "angular" "https://github.com/angular/angular.dart"
125 12
126 echo "*** Generating test files" 13 echo "*** Generating test files"
127 generate_test_files 14 ./generate_angular_tests.sh
OLDNEW
« third_party/pkg/generate_angular_tests.sh ('K') | « third_party/pkg/generate_angular_tests.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698