| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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.backend.js.AbstractJsBackend.EXTENSION_AP
P_JS; | 7 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_AP
P_JS; |
| 8 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_JS
; | 8 import static com.google.dart.compiler.backend.js.AbstractJsBackend.EXTENSION_JS
; |
| 9 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; | 9 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; |
| 10 import static com.google.dart.compiler.common.ErrorExpectation.errEx; | 10 import static com.google.dart.compiler.common.ErrorExpectation.errEx; |
| 11 | 11 |
| 12 import com.google.common.collect.Lists; | 12 import com.google.common.collect.Lists; |
| 13 import com.google.dart.compiler.CommandLineOptions.CompilerOptions; |
| 13 import com.google.dart.compiler.CompilerTestCase; | 14 import com.google.dart.compiler.CompilerTestCase; |
| 14 import com.google.dart.compiler.DartCompilationError; | 15 import com.google.dart.compiler.DartCompilationError; |
| 15 import com.google.dart.compiler.DartCompiler; | 16 import com.google.dart.compiler.DartCompiler; |
| 16 import com.google.dart.compiler.DartCompilerListener; | 17 import com.google.dart.compiler.DartCompilerListener; |
| 17 import com.google.dart.compiler.DefaultCompilerConfiguration; | 18 import com.google.dart.compiler.DefaultCompilerConfiguration; |
| 18 import com.google.dart.compiler.LibrarySource; | 19 import com.google.dart.compiler.LibrarySource; |
| 19 import com.google.dart.compiler.MockArtifactProvider; | 20 import com.google.dart.compiler.MockArtifactProvider; |
| 20 import com.google.dart.compiler.Source; | 21 import com.google.dart.compiler.Source; |
| 21 import com.google.dart.compiler.backend.js.JavascriptBackend; | 22 import com.google.dart.compiler.backend.js.JavascriptBackend; |
| 22 import com.google.dart.compiler.resolver.ResolverErrorCode; | 23 import com.google.dart.compiler.resolver.ResolverErrorCode; |
| 23 import com.google.dart.compiler.resolver.TypeErrorCode; | 24 import com.google.dart.compiler.resolver.TypeErrorCode; |
| 24 | 25 |
| 25 import junit.framework.AssertionFailedError; | 26 import junit.framework.AssertionFailedError; |
| 26 | 27 |
| 27 import java.io.IOException; | 28 import java.io.IOException; |
| 28 import java.io.Reader; | 29 import java.io.Reader; |
| 29 import java.io.StringReader; | 30 import java.io.StringReader; |
| 30 import java.io.Writer; | 31 import java.io.Writer; |
| 31 import java.util.List; | 32 import java.util.List; |
| 32 import java.util.Set; | 33 import java.util.Set; |
| 33 import java.util.concurrent.ConcurrentSkipListSet; | 34 import java.util.concurrent.ConcurrentSkipListSet; |
| 34 | 35 |
| 36 // TODO(zundel): update this test not to rely on code generation |
| 35 public class IncrementalCompilation2Test extends CompilerTestCase { | 37 public class IncrementalCompilation2Test extends CompilerTestCase { |
| 36 private static final String APP = "Application.dart"; | 38 private static final String APP = "Application.dart"; |
| 37 | 39 |
| 38 private static class IncMockArtifactProvider extends MockArtifactProvider { | 40 private static class IncMockArtifactProvider extends MockArtifactProvider { |
| 39 Set<String> reads = new ConcurrentSkipListSet<String>(); | 41 Set<String> reads = new ConcurrentSkipListSet<String>(); |
| 40 Set<String> writes = new ConcurrentSkipListSet<String>(); | 42 Set<String> writes = new ConcurrentSkipListSet<String>(); |
| 41 | 43 |
| 42 @Override | 44 @Override |
| 43 public Reader getArtifactReader(Source source, String part, String extension
) { | 45 public Reader getArtifactReader(Source source, String part, String extension
) { |
| 44 reads.add(source.getName() + "/" + extension); | 46 reads.add(source.getName() + "/" + extension); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 65 "// filler filler filler filler filler filler filler filler filler filler
filler", | 67 "// filler filler filler filler filler filler filler filler filler filler
filler", |
| 66 "#library('application');", | 68 "#library('application');", |
| 67 "#source('A.dart');", | 69 "#source('A.dart');", |
| 68 "#source('B.dart');", | 70 "#source('B.dart');", |
| 69 "#source('C.dart');", | 71 "#source('C.dart');", |
| 70 ""); | 72 ""); |
| 71 private final List<DartCompilationError> errors = Lists.newArrayList(); | 73 private final List<DartCompilationError> errors = Lists.newArrayList(); |
| 72 | 74 |
| 73 @Override | 75 @Override |
| 74 protected void setUp() throws Exception { | 76 protected void setUp() throws Exception { |
| 75 config = new DefaultCompilerConfiguration(new JavascriptBackend()) { | 77 CompilerOptions compilerOptions = new CompilerOptions() { |
| 78 // TODO(zundel): Update these tests to run without requiring code generati
on |
| 79 @Override |
| 80 public boolean checkOnly() { |
| 81 return false; |
| 82 } |
| 83 }; |
| 84 config = new DefaultCompilerConfiguration(new JavascriptBackend(), |
| 85 compilerOptions) { |
| 76 @Override | 86 @Override |
| 77 public boolean incremental() { | 87 public boolean incremental() { |
| 78 return true; | 88 return true; |
| 79 } | 89 } |
| 80 }; | 90 }; |
| 81 provider = new IncMockArtifactProvider(); | 91 provider = new IncMockArtifactProvider(); |
| 82 appSource = new MemoryLibrarySource(APP, "<not-used>") { | 92 appSource = new MemoryLibrarySource(APP, "<not-used>") { |
| 83 @Override | 93 @Override |
| 84 public long getLastModified() { | 94 public long getLastModified() { |
| 85 return appSourceLastModified; | 95 return appSourceLastModified; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 private void didWrite(String sourceName, String extension) { | 562 private void didWrite(String sourceName, String extension) { |
| 553 String spec = sourceName + "/" + extension; | 563 String spec = sourceName + "/" + extension; |
| 554 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); | 564 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); |
| 555 } | 565 } |
| 556 | 566 |
| 557 private void didNotWrite(String sourceName, String extension) { | 567 private void didNotWrite(String sourceName, String extension) { |
| 558 String spec = sourceName + "/" + extension; | 568 String spec = sourceName + "/" + extension; |
| 559 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); | 569 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); |
| 560 } | 570 } |
| 561 } | 571 } |
| OLD | NEW |