Index: pkg/analyzer/test/src/context/context_test.dart |
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart |
index 7bc47ba7aebdac6ce85f8d12e3dd62d69f9f4cfe..8f960348427ad4e451274a5a426c00c22bd5bec5 100644 |
--- a/pkg/analyzer/test/src/context/context_test.dart |
+++ b/pkg/analyzer/test/src/context/context_test.dart |
@@ -55,6 +55,32 @@ main() { |
@reflectiveTest |
class AnalysisContextImplTest extends AbstractContextTest { |
+ Future fail_analyzedSources_removed() async { |
+ AnalyzedSourcesListener listener = new AnalyzedSourcesListener(); |
+ context.implicitAnalysisEvents.listen(listener.onData); |
+ // |
+ // Create a file that references an file that is not explicitly being |
+ // analyzed and fully analyze it. Ensure that the listener is told about |
+ // the implicitly analyzed file. |
+ // |
+ Source sourceA = newSource('/a.dart', "library a; import 'b.dart';"); |
+ Source sourceB = newSource('/b.dart', "library b;"); |
+ ChangeSet changeSet = new ChangeSet(); |
+ changeSet.addedSource(sourceA); |
+ context.applyChanges(changeSet); |
+ context.computeErrors(sourceA); |
+ await pumpEventQueue(); |
+ listener.expectAnalyzed(sourceB); |
+ // |
+ // Remove the reference and ensure that the listener is told that we're no |
+ // longer implicitly analyzing the file. |
+ // |
+ context.setContents(sourceA, "library a;"); |
+ context.computeErrors(sourceA); |
+ await pumpEventQueue(); |
+ listener.expectNotAnalyzed(sourceB); |
+ } |
+ |
void fail_performAnalysisTask_importedLibraryDelete_html() { |
// NOTE: This was failing before converting to the new task model. |
Source htmlSource = addSource("/page.html", r''' |
@@ -90,6 +116,24 @@ class AnalysisContextImplTest extends AbstractContextTest { |
super.tearDown(); |
} |
+ Future test_analyzedSources_added() async { |
+ AnalyzedSourcesListener listener = new AnalyzedSourcesListener(); |
+ context.implicitAnalysisEvents.listen(listener.onData); |
+ // |
+ // Create a file that references an file that is not explicitly being |
+ // analyzed and fully analyze it. Ensure that the listener is told about |
+ // the implicitly analyzed file. |
+ // |
+ Source sourceA = newSource('/a.dart', "library a; import 'b.dart';"); |
+ Source sourceB = newSource('/b.dart', "library b;"); |
+ ChangeSet changeSet = new ChangeSet(); |
+ changeSet.addedSource(sourceA); |
+ context.applyChanges(changeSet); |
+ context.computeErrors(sourceA); |
+ await pumpEventQueue(); |
+ listener.expectAnalyzed(sourceB); |
+ } |
+ |
Future test_applyChanges_add() { |
SourcesChangedListener listener = new SourcesChangedListener(); |
context.onSourcesChanged.listen(listener.onData); |