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

Side by Side 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, 2 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Helper class for writing compiler tests.
6 library trydart.compiler_test_case;
7
8 import 'dart:async' show
9 Future;
10
11 export 'dart:async' show
12 Future;
13
14 import 'package:async_helper/async_helper.dart' show
15 asyncTest;
16
17 import '../../compiler/dart2js/compiler_helper.dart' show
18 MockCompiler,
19 compilerFor;
20
21 export 'package:expect/expect.dart' show
22 Expect;
23
24 const String SCHEME = 'org.trydart.compiler-test-case';
25
26 Uri customUri(String path) => Uri.parse('$SCHEME://$path');
27
28 Future runTests(List<CompilerTest> tests) {
29 asyncTest(() => Future.forEach(tests, runTest));
30 }
31
32 Future runTest(CompilerTestCase test) {
33 print('\n{{{\n$test\n\n=== Test Output:\n');
34 return test.run().then((_) {
35 print('}}}');
36 });
37 }
38
39 abstract class CompilerTestCase {
40 final String source;
41
42 final Uri scriptUri;
43
44 final MockCompiler compiler;
45
46 Future<LibraryElement> mainAppCache;
47
48 CompilerTestCase.init(this.source, this.scriptUri, this.compiler);
49
50 CompilerTestCase.intermediate(String source, Uri scriptUri)
51 : this.init(source, scriptUri, compilerFor(source, scriptUri));
52
53 CompilerTestCase(String source, [String path])
54 : this.intermediate(source, customUri(path == null ? 'main.dart' : path));
55
56 Future<LibraryElement> get mainApp {
57 if (mainAppCache == null) {
58 mainAppCache = compiler.libraryLoader.loadLibrary(scriptUri);
59 }
60 return mainAppCache;
61 }
62
63 Future run();
64
65 String toString() => source;
66 }
OLDNEW
« 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