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

Unified Diff: third_party/pkg/generate_angular_tests.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/third_party/angular_tests/vm_test.dart ('k') | third_party/pkg/update_angular.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/generate_angular_tests.sh
diff --git a/third_party/pkg/generate_angular_tests.sh b/third_party/pkg/generate_angular_tests.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ce1cd05c6940c6cb9b03f6cf67d56c87bdef1847
--- /dev/null
+++ b/third_party/pkg/generate_angular_tests.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# bail on error
+set -e
+
+generate_test_files() {
+ pushd angular/test > /dev/null
+
+ local out_dir='../../../../pkg/third_party/angular_tests'
+
+ generate_browser_tests
+ generate_vm_tests
+ popd > /dev/null
+}
+
+generate_browser_tests() {
+ local test_file="${out_dir}/browser_test.dart"
+ local tests=$(find * -name "*_spec.dart" \
+ -not -path "playback/*" \
+ -not -path "io/*" \
+ -not -path "tools/*" \
+ -not -path "*/generated_parser_spec.dart")
+
+ mkdir -p "${out_dir}"
+ cat << END_HEADER > "${test_file}"
Siggi Cherem (dart-lang) 2014/01/10 20:50:56 consider creating a folder with these template pie
+/// auto-generated by update_angular.sh
+
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library angular_browser_tests;
+
+import 'package:angular/mock/module.dart';
+import 'package:unittest/html_individual_config.dart';
+import 'package:unittest/unittest.dart';
+
+END_HEADER
+
+ local index=0
+ for src_file in ${tests}; do
+ local import_file="../../../third_party/pkg/angular/test/${src_file}"
+ 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
+ index=$(expr ${index} + 1)
+ done
+
+ cat << END_START_MAIN >> "${test_file}"
+
+main() {
+ useHtmlIndividualConfiguration();
+
+ setUp(() {
+ setUpInjector();
+ });
+
+END_START_MAIN
+
+ index=0
+ for src_file in ${tests}; do
+ cat << END_TEST_BODY >> "${test_file}"
+ group('${src_file%_spec.dart}', () {
+ test_${index}.main();
+ });
+
+END_TEST_BODY
+ index=$(expr ${index} + 1)
+ done
+ echo "}" >> "${test_file}"
+}
+
+generate_vm_tests() {
+ local test_file="${out_dir}/vm_test.dart"
+ local tests=$(find tools -name "*_spec.dart")
+
+ mkdir -p "${out_dir}"
+ cat << END_HEADER > "${test_file}"
+/// auto-generated by update_angular.sh
+
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library angular_vm_tests;
+
+import 'package:unittest/compact_vm_config.dart';
+import 'package:unittest/unittest.dart';
+
+END_HEADER
+
+ local index=0
+ for src_file in ${tests}; do
+ local import_file="../../../third_party/pkg/angular/test/${src_file}"
+ echo "import '${import_file}' as test_${index};" >> "${test_file}"
+ index=$(expr ${index} + 1)
+ done
+
+ cat << END_START_MAIN >> "${test_file}"
+
+main() {
+ useCompactVMConfiguration();
+
+END_START_MAIN
+
+ index=0
+ for src_file in ${tests}; do
+ cat << END_TEST_BODY >> "${test_file}"
+ group('${src_file%_spec.dart}', () {
+ test_${index}.main();
+ });
+
+END_TEST_BODY
+ index=$(expr ${index} + 1)
+ done
+ echo "}" >> "${test_file}"
+}
+
+generate_test_files
« no previous file with comments | « pkg/third_party/angular_tests/vm_test.dart ('k') | third_party/pkg/update_angular.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698