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

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

Issue 1033383002: Gracefully handle IO exceptions while resolving URIs (issue 23023) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/generated/engine.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/generated/engine_test.dart
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index 52b8c4026a27a86cb7d29184960b021f504972b3..df19bde330befd044a10459e8513894cd2f9d4bd 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -4539,6 +4539,13 @@ class LintGeneratorTest_Linter_Null_Visitor extends Linter {
AstVisitor getVisitor() => null;
}
+class MockSourceFactory extends SourceFactory {
+ MockSourceFactory() : super([]);
+ Source resolveUri(Source containingSource, String containedUri) {
+ throw new JavaIOException();
+ }
+}
+
@reflectiveTest
class ParseDartTaskTest extends EngineTestCase {
void test_accept() {
@@ -4627,6 +4634,26 @@ class A {}''';
new ParseDartTaskTestTV_perform_validateDirectives(context, source));
}
+ void test_resolveDirective_dartUri() {
+ GatheringErrorListener listener = new GatheringErrorListener();
+ ImportDirective directive = AstFactory.importDirective3('dart:core', null);
+ AnalysisContext context = AnalysisContextFactory.contextWithCore();
+ Source source =
+ ParseDartTask.resolveDirective(context, null, directive, listener);
+ expect(source, isNotNull);
+ }
+
+ void test_resolveDirective_exception() {
+ GatheringErrorListener listener = new GatheringErrorListener();
+ ImportDirective directive = AstFactory.importDirective3('dart:core', null);
+ AnalysisContext context = new AnalysisContextImpl();
+ context.sourceFactory = new MockSourceFactory();
+ Source source =
+ ParseDartTask.resolveDirective(context, null, directive, listener);
+ expect(source, isNull);
+ expect(listener.errors.length, 1);
scheglov 2015/03/27 23:05:58 expect(listener.errors, hasLength(1));
Brian Wilkerson 2015/03/27 23:51:57 Done
+ }
+
/**
* Create and return a task that will parse the given content from the given source in the given
* context.
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698