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

Side by Side Diff: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java

Issue 9479013: Remove backends. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 package com.google.dart.compiler.end2end.inc; 4 package com.google.dart.compiler.end2end.inc;
5 5
6 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; 6 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS;
7 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP;
8 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; 8 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors;
9 import static com.google.dart.compiler.common.ErrorExpectation.errEx; 9 import static com.google.dart.compiler.common.ErrorExpectation.errEx;
10 10
11 import com.google.common.collect.Lists; 11 import com.google.common.collect.Lists;
12 import com.google.dart.compiler.CompilerTestCase; 12 import com.google.dart.compiler.CompilerTestCase;
13 import com.google.dart.compiler.DartCompilationError; 13 import com.google.dart.compiler.DartCompilationError;
14 import com.google.dart.compiler.DartCompiler; 14 import com.google.dart.compiler.DartCompiler;
15 import com.google.dart.compiler.DartCompilerErrorCode; 15 import com.google.dart.compiler.DartCompilerErrorCode;
16 import com.google.dart.compiler.DartCompilerListener; 16 import com.google.dart.compiler.DartCompilerListener;
17 import com.google.dart.compiler.DartSource; 17 import com.google.dart.compiler.DartSource;
18 import com.google.dart.compiler.DefaultCompilerConfiguration; 18 import com.google.dart.compiler.DefaultCompilerConfiguration;
19 import com.google.dart.compiler.LibrarySource; 19 import com.google.dart.compiler.LibrarySource;
20 import com.google.dart.compiler.MockArtifactProvider; 20 import com.google.dart.compiler.MockArtifactProvider;
21 import com.google.dart.compiler.Source; 21 import com.google.dart.compiler.Source;
22 import com.google.dart.compiler.ast.DartUnit; 22 import com.google.dart.compiler.ast.DartUnit;
23 import com.google.dart.compiler.backend.js.JavascriptBackend;
24 import com.google.dart.compiler.resolver.ResolverErrorCode; 23 import com.google.dart.compiler.resolver.ResolverErrorCode;
25 import com.google.dart.compiler.resolver.TypeErrorCode; 24 import com.google.dart.compiler.resolver.TypeErrorCode;
26 25
27 import junit.framework.AssertionFailedError; 26 import junit.framework.AssertionFailedError;
28 27
29 import java.io.IOException; 28 import java.io.IOException;
30 import java.io.Reader; 29 import java.io.Reader;
31 import java.io.StringReader; 30 import java.io.StringReader;
32 import java.io.Writer; 31 import java.io.Writer;
33 import java.util.List; 32 import java.util.List;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 "// filler filler filler filler filler filler filler filler filler filler filler", 67 "// filler filler filler filler filler filler filler filler filler filler filler",
69 "#library('application');", 68 "#library('application');",
70 "#source('A.dart');", 69 "#source('A.dart');",
71 "#source('B.dart');", 70 "#source('B.dart');",
72 "#source('C.dart');", 71 "#source('C.dart');",
73 ""); 72 "");
74 private final List<DartCompilationError> errors = Lists.newArrayList(); 73 private final List<DartCompilationError> errors = Lists.newArrayList();
75 74
76 @Override 75 @Override
77 protected void setUp() throws Exception { 76 protected void setUp() throws Exception {
78 config = new DefaultCompilerConfiguration(new JavascriptBackend()) { 77 config = new DefaultCompilerConfiguration() {
79 @Override 78 @Override
80 public boolean incremental() { 79 public boolean incremental() {
81 return true; 80 return true;
82 } 81 }
83 }; 82 };
84 provider = new IncMockArtifactProvider(); 83 provider = new IncMockArtifactProvider();
85 appSource = new MemoryLibrarySource(APP, "<not-used>") { 84 appSource = new MemoryLibrarySource(APP, "<not-used>") {
86 @Override 85 @Override
87 public long getLastModified() { 86 public long getLastModified() {
88 return appSourceLastModified; 87 return appSourceLastModified;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 didWrite("B.dart", EXTENSION_TIMESTAMP); 177 didWrite("B.dart", EXTENSION_TIMESTAMP);
179 assertAppBuilt(); 178 assertAppBuilt();
180 // "hole" was filled with top-level field. 179 // "hole" was filled with top-level field.
181 assertErrors(errors); 180 assertErrors(errors);
182 } 181 }
183 182
184 /** 183 /**
185 * Test for "hole" feature. If we use unqualified invocation and add/remove to p-level method, this 184 * Test for "hole" feature. If we use unqualified invocation and add/remove to p-level method, this
186 * should cause compilation of invocation unit. 185 * should cause compilation of invocation unit.
187 */ 186 */
188 public void test_isMethodHole_useUnqualifiedInvocation() { 187 public void test_isMethodHole_useUnqualifiedInvocation() throws Exception {
189 appSource.setContent( 188 appSource.setContent(
190 "B.dart", 189 "B.dart",
191 makeCode( 190 makeCode(
192 "// filler filler filler filler filler filler filler filler filler f iller filler", 191 "// filler filler filler filler filler filler filler filler filler f iller filler",
193 "class A {", 192 "class A {",
194 " foo() {}", 193 " foo() {}",
195 "}", 194 "}",
196 "")); 195 ""));
197 appSource.setContent( 196 appSource.setContent(
198 "C.dart", 197 "C.dart",
(...skipping 16 matching lines...) Expand all
215 "foo() {}", 214 "foo() {}",
216 "")); 215 ""));
217 compile(); 216 compile();
218 // B should be compiled because it also declares foo(), so produces "shado w" conflict. 217 // B should be compiled because it also declares foo(), so produces "shado w" conflict.
219 // C should be compiled because it has unqualified invocation which was de clared in A. 218 // C should be compiled because it has unqualified invocation which was de clared in A.
220 didWrite("A.dart", EXTENSION_TIMESTAMP); 219 didWrite("A.dart", EXTENSION_TIMESTAMP);
221 didWrite("B.dart", EXTENSION_TIMESTAMP); 220 didWrite("B.dart", EXTENSION_TIMESTAMP);
222 didWrite("C.dart", EXTENSION_TIMESTAMP); 221 didWrite("C.dart", EXTENSION_TIMESTAMP);
223 assertAppBuilt(); 222 assertAppBuilt();
224 } 223 }
224 // Wait, because analysis is so fast that may be A will have same time as ol d artifact.
225 Thread.sleep(5);
225 // Remove top-level foo(), so invocation of foo() in B should be bound to th e super class. 226 // Remove top-level foo(), so invocation of foo() in B should be bound to th e super class.
226 { 227 {
227 appSource.setContent("A.dart", ""); 228 appSource.setContent("A.dart", "");
228 compile(); 229 compile();
229 // B should be compiled because it also declares foo(), so produces "shado w" conflict. 230 // B should be compiled because it also declares foo(), so produces "shado w" conflict.
230 // C should be compiled because it has unqualified invocation which was de clared in A. 231 // C should be compiled because it has unqualified invocation which was de clared in A.
231 didWrite("A.dart", EXTENSION_TIMESTAMP); 232 didWrite("A.dart", EXTENSION_TIMESTAMP);
232 didWrite("B.dart", EXTENSION_TIMESTAMP); 233 didWrite("B.dart", EXTENSION_TIMESTAMP);
233 didWrite("C.dart", EXTENSION_TIMESTAMP); 234 didWrite("C.dart", EXTENSION_TIMESTAMP);
234 } 235 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 didWrite("B.dart", EXTENSION_TIMESTAMP); 275 didWrite("B.dart", EXTENSION_TIMESTAMP);
275 didNotWrite("C.dart", EXTENSION_TIMESTAMP); 276 didNotWrite("C.dart", EXTENSION_TIMESTAMP);
276 assertAppBuilt(); 277 assertAppBuilt();
277 } 278 }
278 } 279 }
279 280
280 /** 281 /**
281 * Test for "hole" feature. If we use unqualified access and add/remove top-le vel field, this 282 * Test for "hole" feature. If we use unqualified access and add/remove top-le vel field, this
282 * should cause compilation of invocation unit. 283 * should cause compilation of invocation unit.
283 */ 284 */
284 public void test_fieldHole_useUnqualifiedAccess() { 285 public void test_fieldHole_useUnqualifiedAccess() throws Exception {
285 appSource.setContent( 286 appSource.setContent(
286 "B.dart", 287 "B.dart",
287 makeCode( 288 makeCode(
288 "// filler filler filler filler filler filler filler filler filler f iller filler", 289 "// filler filler filler filler filler filler filler filler filler f iller filler",
289 "class A {", 290 "class A {",
290 " var foo;", 291 " var foo;",
291 "}", 292 "}",
292 "")); 293 ""));
293 appSource.setContent( 294 appSource.setContent(
294 "C.dart", 295 "C.dart",
(...skipping 16 matching lines...) Expand all
311 "var foo;", 312 "var foo;",
312 "")); 313 ""));
313 compile(); 314 compile();
314 // B should be compiled because it also declares "foo", so produces "shado w" conflict. 315 // B should be compiled because it also declares "foo", so produces "shado w" conflict.
315 // C should be compiled because it has unqualified invocation which was de clared in A. 316 // C should be compiled because it has unqualified invocation which was de clared in A.
316 didWrite("A.dart", EXTENSION_TIMESTAMP); 317 didWrite("A.dart", EXTENSION_TIMESTAMP);
317 didWrite("B.dart", EXTENSION_TIMESTAMP); 318 didWrite("B.dart", EXTENSION_TIMESTAMP);
318 didWrite("C.dart", EXTENSION_TIMESTAMP); 319 didWrite("C.dart", EXTENSION_TIMESTAMP);
319 assertAppBuilt(); 320 assertAppBuilt();
320 } 321 }
322 // Wait, because analysis is so fast that may be A will have same time as ol d artifact.
323 Thread.sleep(5);
321 // Remove top-level "foo", so access to "foo" in B should be bound to the su per class. 324 // Remove top-level "foo", so access to "foo" in B should be bound to the su per class.
322 { 325 {
323 appSource.setContent("A.dart", ""); 326 appSource.setContent("A.dart", "");
324 compile(); 327 compile();
325 // B should be compiled because it also declares "foo", so produces "shado w" conflict. 328 // B should be compiled because it also declares "foo", so produces "shado w" conflict.
326 // C should be compiled because it has unqualified access which was declar ed in A. 329 // C should be compiled because it has unqualified access which was declar ed in A.
327 didWrite("A.dart", EXTENSION_TIMESTAMP); 330 didWrite("A.dart", EXTENSION_TIMESTAMP);
328 didWrite("B.dart", EXTENSION_TIMESTAMP); 331 didWrite("B.dart", EXTENSION_TIMESTAMP);
329 didWrite("C.dart", EXTENSION_TIMESTAMP); 332 didWrite("C.dart", EXTENSION_TIMESTAMP);
330 } 333 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 private void didWrite(String sourceName, String extension) { 594 private void didWrite(String sourceName, String extension) {
592 String spec = sourceName + "/" + extension; 595 String spec = sourceName + "/" + extension;
593 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); 596 assertTrue("Expected write: " + spec, provider.writes.contains(spec));
594 } 597 }
595 598
596 private void didNotWrite(String sourceName, String extension) { 599 private void didNotWrite(String sourceName, String extension) {
597 String spec = sourceName + "/" + extension; 600 String spec = sourceName + "/" + extension;
598 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); 601 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec));
599 } 602 }
600 } 603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698