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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2226613004: Suppress follow-on errors when a file is imported with either a prefix or a show clause (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cache URI existence in a modifier' Created 4 years, 4 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/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 988db569fa3a0375ee004bc23552fba47fed4ad6..b005734298c2b122d5539d5c18586f326b7a85ed 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -155,6 +155,43 @@ class AnalysisContextImplTest extends AbstractContextTest {
expect(entry.explicitlyAdded, isTrue);
}
+ void test_applyChanges_addNewImport_invalidateLibraryCycle() {
+ context.analysisOptions =
+ new AnalysisOptionsImpl.from(context.analysisOptions)
+ ..strongMode = true;
+ Source embedder = addSource(
+ '/a.dart',
+ r'''
+library a;
+import 'b.dart';
+//import 'c.dart';
+''');
+ addSource(
+ '/b.dart',
+ r'''
+library b;
+import 'a.dart';
+''');
+ addSource(
+ '/c.dart',
+ r'''
+library c;
+import 'b.dart';
+''');
+ _performPendingAnalysisTasks();
+ // Add a new import into a.dart, this should invalidate its library cycle.
+ // If it doesn't, we will get a task cycle exception.
+ context.setContents(
+ embedder,
+ r'''
+library a;
+import 'b.dart';
+import 'c.dart';
+''');
+ _performPendingAnalysisTasks();
+ expect(context.getCacheEntry(embedder).exception, isNull);
+ }
+
Future test_applyChanges_change() {
SourcesChangedListener listener = new SourcesChangedListener();
context.onSourcesChanged.listen(listener.onData);
@@ -378,7 +415,7 @@ import 'libB.dart';''';
expect(sources[0], same(libA));
libAElement = context.computeLibraryElement(libA);
importedLibraries = libAElement.importedLibraries;
- expect(importedLibraries, hasLength(1));
+ expect(importedLibraries, hasLength(2));
return pumpEventQueue().then((_) {
listener.assertEvent(wereSourcesAdded: true);
listener.assertEvent(wereSourcesAdded: true);
@@ -487,43 +524,6 @@ class B {}
expect(context.getErrors(a).errors, hasLength(0));
}
- void test_applyChanges_addNewImport_invalidateLibraryCycle() {
- context.analysisOptions =
- new AnalysisOptionsImpl.from(context.analysisOptions)
- ..strongMode = true;
- Source embedder = addSource(
- '/a.dart',
- r'''
-library a;
-import 'b.dart';
-//import 'c.dart';
-''');
- addSource(
- '/b.dart',
- r'''
-library b;
-import 'a.dart';
-''');
- addSource(
- '/c.dart',
- r'''
-library c;
-import 'b.dart';
-''');
- _performPendingAnalysisTasks();
- // Add a new import into a.dart, this should invalidate its library cycle.
- // If it doesn't, we will get a task cycle exception.
- context.setContents(
- embedder,
- r'''
-library a;
-import 'b.dart';
-import 'c.dart';
-''');
- _performPendingAnalysisTasks();
- expect(context.getCacheEntry(embedder).exception, isNull);
- }
-
void test_cacheConsistencyValidator_computed_deleted() {
CacheConsistencyValidator validator = context.cacheConsistencyValidator;
var stat = PerformanceStatistics.cacheConsistencyValidationStatistics;
@@ -3750,6 +3750,7 @@ main() {
MethodInvocation invocation = statement.expression;
return invocation.argumentList.arguments[0];
}
+
{
Expression argument = find42();
expect(argument.staticParameterElement, isNull);

Powered by Google App Engine
This is Rietveld 408576698