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

Unified Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2489523008: Fix disposing context with the new driver. (Closed)
Patch Set: Created 4 years, 1 month 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/dart/analysis/file_state.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/src/dart/analysis/driver_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 1057800c09f11699dbd9acaa462834f97dd0d54b..ccdcc9223baf1228ba20f462feb9980e3e3cbfe1 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -265,6 +265,19 @@ class AnalysisDriverTest {
driver.results.listen(allResults.add);
}
+ test_addedFiles() async {
+ var a = _p('/test/lib/a.dart');
+ var b = _p('/test/lib/b.dart');
+
+ driver.addFile(a);
+ expect(driver.addedFiles, contains(a));
+ expect(driver.addedFiles, isNot(contains(b)));
+
+ driver.removeFile(a);
+ expect(driver.addedFiles, isNot(contains(a)));
+ expect(driver.addedFiles, isNot(contains(b)));
+ }
+
test_addFile_thenRemove() async {
var a = _p('/test/lib/a.dart');
var b = _p('/test/lib/b.dart');
@@ -704,17 +717,27 @@ var A2 = B1;
expect(result1.unit, isNotNull);
}
- test_isAddedFile() async {
+ test_knownFiles() async {
var a = _p('/test/lib/a.dart');
var b = _p('/test/lib/b.dart');
+ provider.newFile(
+ a,
+ r'''
+import 'b.dart';
+''');
+
driver.addFile(a);
- expect(driver.isAddedFile(a), isTrue);
- expect(driver.isAddedFile(b), isFalse);
+ await _waitForIdle();
+
+ expect(driver.knownFiles, contains(a));
+ expect(driver.knownFiles, contains(b));
driver.removeFile(a);
- expect(driver.isAddedFile(a), isFalse);
- expect(driver.isAddedFile(b), isFalse);
+
+ // a.dart was removed, but we don't clean up the file state state yet.
+ expect(driver.knownFiles, contains(a));
+ expect(driver.knownFiles, contains(b));
}
test_part_getResult_afterLibrary() async {
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/file_state.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698