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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 2052223003: Enhance the tests for ComputeLibraryCycleTask (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index f71c6ffe729c60cdc85ee88ec6dfddbcc3813aaf..9892d3fbc2ad5647fc68cffb10ace4f1863926b3 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -1573,6 +1573,7 @@ import 'my_lib2.dart';
AnalysisTarget lib1Target = new LibrarySpecificUnit(lib1Source, lib1Source);
AnalysisTarget lib2Target = new LibrarySpecificUnit(lib2Source, lib2Source);
AnalysisTarget lib3Target = new LibrarySpecificUnit(lib3Source, lib3Source);
+
computeResult(lib1Target, LIBRARY_CYCLE);
expect(outputs[LIBRARY_CYCLE], hasLength(1));
computeResult(lib2Target, LIBRARY_CYCLE);
@@ -1580,13 +1581,17 @@ import 'my_lib2.dart';
computeResult(lib3Target, LIBRARY_CYCLE);
expect(outputs[LIBRARY_CYCLE], hasLength(1));
- // complete the cycle
+ // create a cycle
context.setContents(
lib1Source,
'''
library my_lib1;
import 'my_lib3.dart';
''');
+ _expectInvalid(lib1Target);
+ _expectInvalid(lib2Target);
+ _expectInvalid(lib3Target);
+
computeResult(lib1Target, LIBRARY_CYCLE);
expect(outputs[LIBRARY_CYCLE], hasLength(3));
computeResult(lib2Target, LIBRARY_CYCLE);
@@ -1600,6 +1605,10 @@ import 'my_lib3.dart';
'''
library my_lib1;
''');
+ _expectInvalid(lib1Target);
+ _expectInvalid(lib2Target);
+ _expectInvalid(lib3Target);
+
computeResult(lib1Target, LIBRARY_CYCLE);
expect(outputs[LIBRARY_CYCLE], hasLength(1));
computeResult(lib2Target, LIBRARY_CYCLE);
@@ -1630,6 +1639,7 @@ import 'my_lib2.dart';
AnalysisTarget lib1Target = new LibrarySpecificUnit(lib1Source, lib1Source);
AnalysisTarget lib2Target = new LibrarySpecificUnit(lib2Source, lib2Source);
AnalysisTarget lib3Target = new LibrarySpecificUnit(lib3Source, lib3Source);
+
computeResult(lib1Target, LIBRARY_CYCLE);
expect(outputs[LIBRARY_CYCLE], hasLength(1));
computeResult(lib2Target, LIBRARY_CYCLE);
@@ -1644,6 +1654,10 @@ import 'my_lib2.dart';
library my_lib1;
import 'my_lib3.dart';
''');
+ _expectInvalid(lib1Target);
+ _expectInvalid(lib2Target);
+ _expectInvalid(lib3Target);
+
// Ensure that invalidation correctly invalidated everything reachable
// through lib3
computeResult(lib1Target, LIBRARY_CYCLE);
@@ -1763,6 +1777,9 @@ library my_lib1;
import 'my_lib3.dart';
var foo = 123;
''');
+ _expectInvalid(lib1Target);
+ _expectInvalid(lib2Target);
+ _expectInvalid(lib3Target);
computeResult(lib1Target, RESOLVED_UNIT);
computeResult(lib2Target, RESOLVED_UNIT);
@@ -1999,6 +2016,11 @@ import 'dart:core';
expect(dep6, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart
expect(dep7, hasLength(5)); // dart:core, a.dart, aa.dart, ab.dart, b.dart
}
+
+ void _expectInvalid(LibrarySpecificUnit target) {
+ CacheEntry entry = context.getCacheEntry(target);
+ expect(entry.getState(LIBRARY_CYCLE), CacheState.INVALID);
+ }
}
@reflectiveTest
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698