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

Unified Diff: dart/tests/try/poi/compiler_test_case.dart

Issue 594843003: Introduce LibraryUpdater. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Johnni's comments. Created 6 years, 3 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 | « dart/site/try/poi/poi.dart ('k') | dart/tests/try/poi/library_updater_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/try/poi/compiler_test_case.dart
diff --git a/dart/tests/try/poi/compiler_test_case.dart b/dart/tests/try/poi/compiler_test_case.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c24a88dd6ec87aeae40b429cf56c7dd92f1ac42e
--- /dev/null
+++ b/dart/tests/try/poi/compiler_test_case.dart
@@ -0,0 +1,66 @@
+// 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.
+
+// Helper class for writing compiler tests.
+library trydart.compiler_test_case;
+
+import 'dart:async' show
+ Future;
+
+export 'dart:async' show
+ Future;
+
+import 'package:async_helper/async_helper.dart' show
+ asyncTest;
+
+import '../../compiler/dart2js/compiler_helper.dart' show
+ MockCompiler,
+ compilerFor;
+
+export 'package:expect/expect.dart' show
+ Expect;
+
+const String SCHEME = 'org.trydart.compiler-test-case';
+
+Uri customUri(String path) => Uri.parse('$SCHEME://$path');
+
+Future runTests(List<CompilerTest> tests) {
+ asyncTest(() => Future.forEach(tests, runTest));
+}
+
+Future runTest(CompilerTestCase test) {
+ print('\n{{{\n$test\n\n=== Test Output:\n');
+ return test.run().then((_) {
+ print('}}}');
+ });
+}
+
+abstract class CompilerTestCase {
+ final String source;
+
+ final Uri scriptUri;
+
+ final MockCompiler compiler;
+
+ Future<LibraryElement> mainAppCache;
+
+ CompilerTestCase.init(this.source, this.scriptUri, this.compiler);
+
+ CompilerTestCase.intermediate(String source, Uri scriptUri)
+ : this.init(source, scriptUri, compilerFor(source, scriptUri));
+
+ CompilerTestCase(String source, [String path])
+ : this.intermediate(source, customUri(path == null ? 'main.dart' : path));
+
+ Future<LibraryElement> get mainApp {
+ if (mainAppCache == null) {
+ mainAppCache = compiler.libraryLoader.loadLibrary(scriptUri);
+ }
+ return mainAppCache;
+ }
+
+ Future run();
+
+ String toString() => source;
+}
« no previous file with comments | « dart/site/try/poi/poi.dart ('k') | dart/tests/try/poi/library_updater_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698