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

Unified Diff: pkg/analyzer/test/generated/engine_test.dart

Issue 661603004: Generalize source entry (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/engine_test.dart
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index f7e2a16946ddb72f8a55aeeedaa2ffa88b03727c..459253e537cbbb71f90780104b83ef574dd55f20 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -543,7 +543,7 @@ class AnalysisContextImplTest extends EngineTestCase {
CompilationUnit resolvedUnit =
_context.computeResolvableCompilationUnit(source);
JUnitTestCase.assertNotNull(resolvedUnit);
- JUnitTestCase.assertNotSame(parsedUnit, resolvedUnit);
+ JUnitTestCase.assertSame(parsedUnit, resolvedUnit);
}
void test_dispose() {
@@ -2200,19 +2200,20 @@ class DartEntryTest extends EngineTestCase {
}
void test_getResolvableCompilationUnit_parsed_accessed() {
- String importUri = "f1.dart";
+ Source librarySource = new TestSource("/lib.dart");
+ String importUri = "/f1.dart";
Source importSource = new TestSource(importUri);
ImportDirective importDirective =
AstFactory.importDirective3(importUri, null, []);
importDirective.source = importSource;
importDirective.uriContent = importUri;
- String exportUri = "f2.dart";
+ String exportUri = "/f2.dart";
Source exportSource = new TestSource(exportUri);
ExportDirective exportDirective =
AstFactory.exportDirective2(exportUri, []);
exportDirective.source = exportSource;
exportDirective.uriContent = exportUri;
- String partUri = "f3.dart";
+ String partUri = "/f3.dart";
Source partSource = new TestSource(partUri);
PartDirective partDirective = AstFactory.partDirective2(partUri);
partDirective.source = partSource;
@@ -2223,6 +2224,9 @@ class DartEntryTest extends EngineTestCase {
entry.setValue(DartEntry.PARSED_UNIT, unit);
entry.getValue(DartEntry.PARSED_UNIT);
CompilationUnit result = entry.resolvableCompilationUnit;
+ JUnitTestCase.assertSame(unit, result);
+ entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, unit);
+ result = entry.resolvableCompilationUnit;
JUnitTestCase.assertNotSame(unit, result);
NodeList<Directive> directives = result.directives;
ImportDirective resultImportDirective = directives[0] as ImportDirective;
@@ -2287,7 +2291,7 @@ class DartEntryTest extends EngineTestCase {
try {
entry.getStateInLibrary(DartEntry.ELEMENT, new TestSource());
JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
@@ -2298,7 +2302,7 @@ class DartEntryTest extends EngineTestCase {
entry.getState(DartEntry.RESOLUTION_ERRORS);
JUnitTestCase.fail(
"Expected IllegalArgumentException for RESOLUTION_ERRORS");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
@@ -2309,17 +2313,31 @@ class DartEntryTest extends EngineTestCase {
entry.getState(DartEntry.VERIFICATION_ERRORS);
JUnitTestCase.fail(
"Expected IllegalArgumentException for VERIFICATION_ERRORS");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
+ void test_getValue_containingLibraries() {
+ Source testSource = new TestSource();
+ DartEntry entry = new DartEntry();
+ List<Source> value = entry.containingLibraries;
+ EngineTestCase.assertLength(0, value);
+ entry.addContainingLibrary(testSource);
+ value = entry.containingLibraries;
+ EngineTestCase.assertLength(1, value);
+ JUnitTestCase.assertEquals(testSource, value[0]);
+ entry.removeContainingLibrary(testSource);
+ value = entry.containingLibraries;
+ EngineTestCase.assertLength(0, value);
+ }
+
void test_getValueInLibrary_invalid_element() {
DartEntry entry = new DartEntry();
try {
entry.getValueInLibrary(DartEntry.ELEMENT, new TestSource());
JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
@@ -2344,32 +2362,18 @@ class DartEntryTest extends EngineTestCase {
try {
entry.getValueInLibrary(DartEntry.ELEMENT, source3);
JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
- void test_getValue_containingLibraries() {
- Source testSource = new TestSource();
- DartEntry entry = new DartEntry();
- List<Source> value = entry.getValue(DartEntry.CONTAINING_LIBRARIES);
- EngineTestCase.assertLength(0, value);
- entry.addContainingLibrary(testSource);
- value = entry.getValue(DartEntry.CONTAINING_LIBRARIES);
- EngineTestCase.assertLength(1, value);
- JUnitTestCase.assertEquals(testSource, value[0]);
- entry.removeContainingLibrary(testSource);
- value = entry.getValue(DartEntry.CONTAINING_LIBRARIES);
- EngineTestCase.assertLength(0, value);
- }
-
void test_getValue_invalid_resolutionErrors() {
DartEntry entry = new DartEntry();
try {
entry.getValue(DartEntry.RESOLUTION_ERRORS);
JUnitTestCase.fail(
"Expected IllegalArgumentException for RESOLUTION_ERRORS");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
}
}
@@ -2379,7 +2383,7 @@ class DartEntryTest extends EngineTestCase {
entry.getValue(DartEntry.VERIFICATION_ERRORS);
JUnitTestCase.fail(
"Expected IllegalArgumentException for VERIFICATION_ERRORS");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
@@ -2826,20 +2830,6 @@ class DartEntryTest extends EngineTestCase {
// assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source));
}
- void test_recordParseInProcess() {
- DartEntry entry = new DartEntry();
- entry.recordParseInProcess();
- JUnitTestCase.assertSame(
- CacheState.IN_PROCESS,
- entry.getState(DartEntry.PARSE_ERRORS));
- JUnitTestCase.assertSame(
- CacheState.IN_PROCESS,
- entry.getState(DartEntry.PARSED_UNIT));
- JUnitTestCase.assertSame(
- CacheState.IN_PROCESS,
- entry.getState(DartEntry.SOURCE_KIND));
- }
-
void test_recordResolutionError() {
// Source source = new TestSource();
DartEntry entry = new DartEntry();
@@ -3020,20 +3010,6 @@ class DartEntryTest extends EngineTestCase {
// assertSame(CacheState.ERROR, entry.getStateInLibrary(DartEntry.VERIFICATION_ERRORS, source));
}
- void test_recordScanInProcess() {
- DartEntry entry = new DartEntry();
- entry.recordScanInProcess();
- JUnitTestCase.assertSame(
- CacheState.IN_PROCESS,
- entry.getState(SourceEntry.LINE_INFO));
- JUnitTestCase.assertSame(
- CacheState.IN_PROCESS,
- entry.getState(DartEntry.SCAN_ERRORS));
- JUnitTestCase.assertSame(
- CacheState.IN_PROCESS,
- entry.getState(DartEntry.TOKEN_STREAM));
- }
-
void test_recordVerificationErrorInLibrary() {
// TODO(brianwilkerson) This test should set the state for two libraries,
// record an error in one library, then verify that the data for the other
@@ -3194,7 +3170,7 @@ class DartEntryTest extends EngineTestCase {
try {
entry.setStateInLibrary(DartEntry.ELEMENT, null, CacheState.FLUSHED);
JUnitTestCase.fail("Expected IllegalArgumentException for ELEMENT");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
@@ -3205,7 +3181,7 @@ class DartEntryTest extends EngineTestCase {
entry.setState(DartEntry.RESOLUTION_ERRORS, CacheState.FLUSHED);
JUnitTestCase.fail(
"Expected IllegalArgumentException for RESOLUTION_ERRORS");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
}
}
@@ -3215,8 +3191,8 @@ class DartEntryTest extends EngineTestCase {
try {
entry.setState(SourceEntry.LINE_INFO, CacheState.VALID);
JUnitTestCase.fail(
- "Expected IllegalArgumentException for a state of VALID");
- } on IllegalArgumentException catch (exception) {
+ "Expected ArgumentError for a state of VALID");
+ } on ArgumentError catch (exception) {
}
}
@@ -3226,10 +3202,10 @@ class DartEntryTest extends EngineTestCase {
entry.setState(DartEntry.VERIFICATION_ERRORS, CacheState.FLUSHED);
JUnitTestCase.fail(
"Expected IllegalArgumentException for VERIFICATION_ERRORS");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
// Expected
- }
- }
+ }
+ }
void test_setState_isClient() {
state2 = DartEntry.IS_CLIENT;
@@ -3935,7 +3911,7 @@ class HtmlEntryTest extends EngineTestCase {
entry.setValue(DartEntry.ELEMENT, null);
JUnitTestCase.fail(
"Expected IllegalArgumentException for DartEntry.ELEMENT");
- } on IllegalArgumentException catch (exception) {
+ } on ArgumentError catch (exception) {
}
}
@@ -3981,6 +3957,8 @@ class HtmlEntryTest extends EngineTestCase {
HtmlEntry _entryWithValidState() {
HtmlEntry entry = new HtmlEntry();
+ entry.setValue(HtmlEntry.ANGULAR_APPLICATION, null);
+ entry.setValue(HtmlEntry.ANGULAR_COMPONENT, null);
entry.setValue(HtmlEntry.ANGULAR_ERRORS, null);
entry.setValue(HtmlEntry.ELEMENT, null);
entry.setValue(HtmlEntry.HINTS, null);
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698