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

Unified Diff: dart/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java

Issue 11233061: Revert "Parts must start with 'part of'" and "Attempt to fix VM build" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: dart/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
diff --git a/dart/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java b/dart/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
index 9a1cae7321c65bc893e159b4a0e05ea8c14df256..d2b44207ab8e5f4966e47d0d371657361fca802e 100644
--- a/dart/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
+++ b/dart/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
@@ -19,7 +19,6 @@ import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.common.ErrorExpectation;
import com.google.dart.compiler.common.SourceInfo;
-import com.google.dart.compiler.end2end.inc.MemoryLibrarySource;
import com.google.dart.compiler.parser.DartParser;
import com.google.dart.compiler.parser.DartParserRunner;
import com.google.dart.compiler.resolver.Element;
@@ -188,9 +187,10 @@ public abstract class CompilerTestCase extends TestCase {
}
protected AnalyzeLibraryResult analyzeLibrary(String... lines) throws Exception {
+ String name = getName();
testSource = makeCode(lines);
- AnalyzeLibraryResult libraryResult = analyzeLibrary(testSource);
- testUnit = libraryResult.getLibraryUnitResult().getUnits().iterator().next();
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(name, testSource);
+ testUnit = libraryResult.getLibraryUnitResult().getUnit(name);
return libraryResult;
}
@@ -199,24 +199,26 @@ public abstract class CompilerTestCase extends TestCase {
* <p>
* <b>Note:</b> if the IDE changes how it calls analyzeLibrary, this should
* be changed to match.
- * @param code the Dart code to parse/analyze
*
+ * @param name the name to use for the source file
+ * @param code the Dart code to parse/analyze
* @return an {@link AnalyzeLibraryResult} containing the {@link LibraryUnit}
* and all the errors/warnings generated from the supplied code
* @throws Exception
*/
- protected AnalyzeLibraryResult analyzeLibrary(String code)
+ protected AnalyzeLibraryResult analyzeLibrary(String name, String code)
throws Exception {
AnalyzeLibraryResult result = new AnalyzeLibraryResult();
result.source = code;
// Prepare library.
- MemoryLibrarySource lib = new MemoryLibrarySource("Test.dart");
- lib.setContent("Test.dart", code);
+ MockLibrarySource lib = new MockLibrarySource();
// Prepare unit.
Map<URI, DartUnit> testUnits = Maps.newHashMap();
{
- DartSource src = lib.getSourceFor("Test.dart");
+ DartSource src = new DartSourceTest(name, code, lib);
DartUnit unit = makeParser(src, code, result).parseUnit();
+ // Remember unit.
+ lib.addSource(src);
testUnits.put(src.getUri(), unit);
}
DartArtifactProvider provider = new MockArtifactProvider();

Powered by Google App Engine
This is Rietveld 408576698