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

Side by Side Diff: dart/tests/compiler/dart2js/incremental/hello_test.dart

Issue 344203004: Improve incremental compilation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
(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 // Test a sequence of modifications to hello-world which used to cause problems
6 // on Try Dart.
7
8 import 'dart:io' show
9 Platform;
10
11 import 'dart:async' show
12 Future;
13
14 import 'package:try/src/caching_compiler.dart' show
15 reuseCompiler;
16
17 import 'package:compiler/compiler.dart' as compiler;
18
19 import 'package:async_helper/async_helper.dart' show
20 asyncTest;
21
22 import 'package:expect/expect.dart' show
23 Expect;
24
25 import '../memory_source_file_helper.dart' show
26 MemorySourceFileProvider;
27
28 var tests = {
29 '/test1.dart':
30 '''
31 var greeting = "Hello, World!";
32
33 void main() {
34 print(greeting);
35 }
36 ''',
37 '/test2.dart':
38 '''
39 va greeting = "Hello, World!";
40
41 void main() {
42 print(greeting);
43 }
44 ''',
45 '/test3.dart':
46 '''
47 greeting = "Hello, World!";
48
49 void main() {
50 print(greeting);
51 }
52 ''',
53 '/test4.dart':
54 '''
55 in greeting = "Hello, World!";
56
57 void main() {
58 print(greeting);
59 }
60 ''',
61 '/test5.dart':
62 '''
63 int greeting = "Hello, World!";
64
65 void main() {
66 print(greeting);
67 }
68 ''',
69 };
70
71 var testResults = {
72 '/test1.dart': true,
73 '/test2.dart': true,
74 '/test3.dart': false,
75 '/test4.dart': false,
76 '/test5.dart': true,
77 };
78
79 var cachedCompiler;
80
81 main() {
82 Uri libraryRoot = Uri.base.resolve('sdk/');
83 Uri packageRoot = Uri.base.resolveUri(
84 new Uri.file('${Platform.packageRoot}/'));
85 MemorySourceFileProvider provider =
86 new MemorySourceFileProvider(tests);
87 var options = [
kasperl 2014/06/23 12:15:06 Could these common options be shared somehow?
ahe 2014/06/23 12:33:28 Done.
88 '--analyze-main',
89 '--disable-type-inference',
90 '--incremental-support',
91 '--no-source-maps',
92 ];
93 asyncTest(() => runTests(libraryRoot, packageRoot, provider, options));
94 }
95
96 Future runTests(
97 Uri libraryRoot,
98 Uri packageRoot,
99 MemorySourceFileProvider provider,
100 options) {
101 return Future.forEach(tests.keys, (String testName) {
102 cachedCompiler = reuseCompiler(
103 diagnosticHandler: handler,
104 inputProvider: provider,
105 options: options,
106 cachedCompiler: cachedCompiler,
107 libraryRoot: libraryRoot,
108 packageRoot: packageRoot);
109 Uri testUri = Uri.parse('memory:$testName');
110 return cachedCompiler.run(testUri).then((bool success) {
111 Expect.equals(
112 testResults[testName], success,
113 'Compilation unexpectedly ${success ? "succeed" : "failed"}.');
114 });
115 });
116 }
117
118 void handler(Uri uri,
119 int begin,
120 int end,
121 String message,
122 compiler.Diagnostic kind) {
123 if (kind != compiler.Diagnostic.VERBOSE_INFO) {
124 print('$uri:$begin:$end:$message:$kind');
125 }
126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698