Index: pkg/analyzer/test/src/summary/incremental_cache_test.dart |
diff --git a/pkg/analyzer/test/src/summary/incremental_cache_test.dart b/pkg/analyzer/test/src/summary/incremental_cache_test.dart |
index bf7620a6e38c1b7c27ab6f15f8cbcc4f33ebcb7c..bbdeedfe4622694b5a3da4cc96a5405c1b88497f 100644 |
--- a/pkg/analyzer/test/src/summary/incremental_cache_test.dart |
+++ b/pkg/analyzer/test/src/summary/incremental_cache_test.dart |
@@ -3,10 +3,12 @@ |
// BSD-style license that can be found in the LICENSE file. |
import 'package:analyzer/dart/element/element.dart'; |
+import 'package:analyzer/src/generated/error.dart'; |
import 'package:analyzer/src/generated/source.dart'; |
import 'package:analyzer/src/summary/incremental_cache.dart'; |
import 'package:unittest/unittest.dart'; |
+import '../../generated/test_support.dart'; |
import '../../reflective_tests.dart'; |
import '../abstract_single_unit.dart'; |
@@ -119,6 +121,44 @@ main() {} |
expect(bundles, isNotNull); |
} |
+ void test_getSourceErrorsInLibrary_library() { |
+ verifyNoTestUnitErrors = false; |
+ putTestLibrary(r''' |
+main() { |
+ int unusedVar = 42; |
+} |
+'''); |
+ List<AnalysisError> computedErrors = context.computeErrors(testSource); |
+ cache.putSourceErrorsInLibrary(testSource, testSource, computedErrors); |
+ List<AnalysisError> readErrors = |
+ cache.getSourceErrorsInLibrary(testSource, testSource); |
+ new GatheringErrorListener() |
+ ..addAll(readErrors) |
+ ..assertErrors(computedErrors); |
+ } |
+ |
+ void test_getSourceErrorsInLibrary_part() { |
+ verifyNoTestUnitErrors = false; |
+ Source partSource = addSource( |
+ '/foo.dart', |
+ r''' |
+main() { |
+ int unusedVar = 42; |
+} |
+'''); |
+ putTestLibrary(r''' |
+library lib; |
+part 'foo.dart'; |
+'''); |
+ List<AnalysisError> computedErrors = context.computeErrors(partSource); |
+ cache.putSourceErrorsInLibrary(testSource, partSource, computedErrors); |
+ List<AnalysisError> readErrors = |
+ cache.getSourceErrorsInLibrary(testSource, partSource); |
+ new GatheringErrorListener() |
+ ..addAll(readErrors) |
+ ..assertErrors(computedErrors); |
+ } |
+ |
void test_getSourceKind_library() { |
putTestLibrary(r''' |
main() {} |