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

Unified Diff: pkg/analyzer/test/generated/engine_test.dart

Issue 909373003: Report an error on Dart Source reading exception. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/generated/engine_test.dart
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index 0089eb8d04e49585d0c16bf8c171526eb589ba1b..c1664924d9fd5fa17088ed5a05940c2c55a2cef2 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -1636,6 +1636,24 @@ void g() { f(null); }''');
reason: "part resolved 3");
}
+ void test_performAnalysisTask_getContentException_dart() {
+ // add source that throw an exception on "get content"
+ Source source = new _Source_getContent_throwException('test.dart');
+ {
+ ChangeSet changeSet = new ChangeSet();
+ changeSet.addedSource(source);
+ _context.applyChanges(changeSet);
+ }
+ // prepare errors
+ _analyzeAll_assertFinished();
+ List<AnalysisError> errors = _context.getErrors(source).errors;
+ // validate errors
+ expect(errors, hasLength(1));
+ AnalysisError error = errors[0];
+ expect(error.source, same(source));
+ expect(error.errorCode, ScannerErrorCode.UNABLE_GET_CONTENT);
+ }
+
void test_performAnalysisTask_importedLibraryAdd() {
Source libASource =
_addSource("/libA.dart", "library libA; import 'libB.dart';");
@@ -2219,7 +2237,6 @@ library test2;''');
}
}
-
class AnalysisContextImplTest_Source_exists_true extends TestSource {
@override
bool exists() => true;
@@ -3989,6 +4006,7 @@ class GenerateDartHintsTaskTestTV_accept extends TestTaskVisitor<bool> {
bool visitGenerateDartHintsTask(GenerateDartHintsTask task) => true;
}
+
class GenerateDartHintsTaskTestTV_perform extends TestTaskVisitor<bool> {
Source librarySource;
Source partSource;
@@ -4115,12 +4133,12 @@ class GetContentTaskTest extends EngineTestCase {
}
}
-
class GetContentTaskTestTV_accept extends TestTaskVisitor<bool> {
@override
bool visitGetContentTask(GetContentTask task) => true;
}
+
class GetContentTaskTestTV_perform_exception extends TestTaskVisitor<bool> {
@override
bool visitGetContentTask(GetContentTask task) {
@@ -4129,7 +4147,6 @@ class GetContentTaskTestTV_perform_exception extends TestTaskVisitor<bool> {
}
}
-
class GetContentTaskTestTV_perform_valid extends TestTaskVisitor<bool> {
InternalAnalysisContext context;
Source source;
@@ -4999,12 +5016,12 @@ class LintGeneratorTest_Linter extends Linter with SimpleAstVisitor<Object> {
}
}
+
class LintGeneratorTest_Linter_Null_Visitor extends Linter {
@override
AstVisitor getVisitor() => null;
}
-
@reflectiveTest
class ParseDartTaskTest extends EngineTestCase {
void test_accept() {
@@ -7093,6 +7110,17 @@ class _AnalysisContextImplTest_test_applyChanges_removeContainer implements
}
+class _Source_getContent_throwException extends NonExistingSource {
+ _Source_getContent_throwException(String name)
+ : super(name, UriKind.FILE_URI);
+
+ @override
+ TimestampedData<String> get contents {
+ throw 'Read error';
+ }
+}
+
+
class _UniversalCachePartitionTest_test_setMaxCacheSize implements
CacheRetentionPolicy {
@override
« pkg/analyzer/lib/src/generated/engine.dart ('K') | « pkg/analyzer/lib/src/generated/scanner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698