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

Unified Diff: pkg/analyzer/test/src/summary/incremental_cache_test.dart

Issue 2042883002: Add put/getSourceErrorsInLibrary to IncrementalCache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixes for review comments. 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 | « pkg/analyzer/lib/src/summary/incremental_cache.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/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() {}
« no previous file with comments | « pkg/analyzer/lib/src/summary/incremental_cache.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698