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

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

Issue 2965533002: Use AnalysisDriver.getCachedResult() for 'implemented' notification. (Closed)
Patch Set: Created 3 years, 6 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/dart/analysis/driver.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 767e3e66c9834e9c5e464d7a7dd9eeaca19e3547..13a34f9e50f1b39b0bb4643b0b465c383431e50d 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -1082,6 +1082,18 @@ bbb() {}
expect(driver.knownFiles, isNot(contains(templatePath)));
}
+ test_getCachedResult() async {
+ var a = _p('/test/bin/a.dart');
+ provider.newFile(a, 'var a = 1;');
+
+ expect(driver.getCachedResult(a), isNull);
+
+ driver.priorityFiles = [a];
+ AnalysisResult result = await driver.getResult(a);
+
+ expect(driver.getCachedResult(a), same(result));
+ }
+
test_getErrors() async {
String content = 'int f() => 42 + bar();';
addTestFile(content, priority: true);
@@ -1335,6 +1347,51 @@ class C {
expect(result.errors, isEmpty);
}
+ test_getResult_importLibrary_thenRemoveIt() async {
+ var a = _p('/test/lib/a.dart');
+ var b = _p('/test/lib/b.dart');
+ provider.newFile(a, 'class A {}');
+ provider.newFile(
+ b,
+ r'''
+import 'a.dart';
+class B extends A {}
+''');
+
+ driver.addFile(a);
+ driver.addFile(b);
+ await scheduler.waitForIdle();
+
+ // No errors in b.dart
+ {
+ AnalysisResult result = await driver.getResult(b);
+ expect(result.errors, isEmpty);
+ }
+
+ // Remove a.dart and reanalyze.
+ provider.deleteFile(a);
+ driver.removeFile(a);
+
+ // The unresolved URI error must be reported.
+ {
+ AnalysisResult result = await driver.getResult(b);
+ expect(
+ result.errors,
+ contains(predicate((AnalysisError e) =>
+ e.errorCode == CompileTimeErrorCode.URI_DOES_NOT_EXIST)));
+ }
+
+ // Restore a.dart and reanalyze.
+ provider.newFile(a, 'class A {}');
+ driver.addFile(a);
+
+ // No errors in b.dart again.
+ {
+ AnalysisResult result = await driver.getResult(b);
+ expect(result.errors, isEmpty);
+ }
+ }
+
test_getResult_inferTypes_finalField() async {
addTestFile(
r'''
@@ -1661,51 +1718,6 @@ var A2 = B1;
expect(result.unit, isNotNull);
}
- test_getResult_importLibrary_thenRemoveIt() async {
- var a = _p('/test/lib/a.dart');
- var b = _p('/test/lib/b.dart');
- provider.newFile(a, 'class A {}');
- provider.newFile(
- b,
- r'''
-import 'a.dart';
-class B extends A {}
-''');
-
- driver.addFile(a);
- driver.addFile(b);
- await scheduler.waitForIdle();
-
- // No errors in b.dart
- {
- AnalysisResult result = await driver.getResult(b);
- expect(result.errors, isEmpty);
- }
-
- // Remove a.dart and reanalyze.
- provider.deleteFile(a);
- driver.removeFile(a);
-
- // The unresolved URI error must be reported.
- {
- AnalysisResult result = await driver.getResult(b);
- expect(
- result.errors,
- contains(predicate((AnalysisError e) =>
- e.errorCode == CompileTimeErrorCode.URI_DOES_NOT_EXIST)));
- }
-
- // Restore a.dart and reanalyze.
- provider.newFile(a, 'class A {}');
- driver.addFile(a);
-
- // No errors in b.dart again.
- {
- AnalysisResult result = await driver.getResult(b);
- expect(result.errors, isEmpty);
- }
- }
-
test_getResult_twoPendingFutures() async {
String content = 'main() {}';
addTestFile(content, priority: true);
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698