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

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

Issue 2617433003: Set ContentCache for created AnalysisContext(s) to control its view of the world. (Closed)
Patch Set: Created 3 years, 11 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: 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 ea52958478ad03a6aed595c6798d645886112c18..24eb692f3212b72f14c55b5d2ef4fbcb9cd6a38d 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -748,6 +748,23 @@ main() {
}
}
+ test_getResult_fileContentOverlay_throughAnalysisContext() async {
+ var a = _p('/test/bin/a.dart');
+ var b = _p('/test/bin/b.dart');
+
+ provider.newFile(a, 'import "b.dart";');
+ provider.newFile(b, 'var v = 1;');
+ contentOverlay[b] = 'var v = 2;';
+
+ var result = await driver.getResult(a);
+
+ // The content that was set into the overlay for "b" should be visible
+ // through the AnalysisContext that was used to analyze "a".
+ CompilationUnitElement unitA = result.unit.element;
+ Source sourceB = unitA.library.imports[0].importedLibrary.source;
+ expect(unitA.context.getContents(sourceB).data, 'var v = 2;');
+ }
+
test_getResult_inferTypes_finalField() async {
addTestFile(
r'''
« pkg/analyzer/lib/src/dart/analysis/driver.dart ('K') | « pkg/analyzer/lib/src/generated/source.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698