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

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

Issue 2669863003: Handle invalid URIs in summaries. (Closed)
Patch Set: Created 3 years, 11 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/src/summary/summarize_ast_test.dart
diff --git a/pkg/analyzer/test/src/summary/summarize_ast_test.dart b/pkg/analyzer/test/src/summary/summarize_ast_test.dart
index 932e1fcddbe809f5bae3dfbb86b0fdd5dede0e24..59323372f541d90f9f76e218f86f921251b547f7 100644
--- a/pkg/analyzer/test/src/summary/summarize_ast_test.dart
+++ b/pkg/analyzer/test/src/summary/summarize_ast_test.dart
@@ -153,18 +153,22 @@ abstract class LinkedSummarizeAstTest extends SummaryLinkerTest
expect(linked, isNotNull);
validateLinkedLibrary(linked);
unlinkedUnits = <UnlinkedUnit>[linkerInputs.unlinkedDefiningUnit];
- for (String relativeUri
+ for (String relativeUriStr
in linkerInputs.unlinkedDefiningUnit.publicNamespace.parts) {
- UnlinkedUnit unit = uriToUnit[
- resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri))
- .toString()];
- if (unit == null) {
- if (!allowMissingFiles) {
- fail('Test referred to unknown unit $relativeUri');
+ UnlinkedUnit unit;
+ try {
+ Uri relativeUri = Uri.parse(relativeUriStr);
+ unit = uriToUnit[
+ resolveRelativeUri(linkerInputs.testDartUri, relativeUri)
+ .toString()];
+ if (unit == null) {
+ if (!allowMissingFiles) {
+ fail('Test referred to unknown unit $relativeUriStr');
+ }
+ } else {
+ unlinkedUnits.add(unit);
}
- } else {
- unlinkedUnits.add(unit);
- }
+ } on FormatException {}
Brian Wilkerson 2017/02/01 21:02:10 Comment explaining why we don't care about the exc
scheglov 2017/02/01 21:08:48 I made a tweak - we now store an empty unlinked un
}
}

Powered by Google App Engine
This is Rietveld 408576698