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

Unified Diff: lib/src/runner/parse_metadata.dart

Issue 1034813004: Add code to contextualize a span relative to its original source file. (Closed) Base URL: git@github.com:dart-lang/unittest@master
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 | « no previous file | lib/src/util/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/parse_metadata.dart
diff --git a/lib/src/runner/parse_metadata.dart b/lib/src/runner/parse_metadata.dart
index f0bba021660be2ae06ab79aca2b33871107392b2..dcdb31062ba5d4bacce1bb09146cb0da9a38acbc 100644
--- a/lib/src/runner/parse_metadata.dart
+++ b/lib/src/runner/parse_metadata.dart
@@ -96,10 +96,19 @@ Metadata parseMetadata(String path) {
_spanFor(annotation, path));
}
- testOn = args.first.stringValue;
+ testOn = args.first;
}
- return new Metadata.parse(testOn: testOn);
+ try {
+ return new Metadata.parse(
+ testOn: testOn == null ? null : testOn.stringValue);
+ } on SourceSpanFormatException catch (error) {
+ var file = new SourceFile(new File(path).readAsStringSync(),
+ url: p.toUri(path));
+ var span = contextualizeSpan(error.span, testOn, file);
+ if (span == null) rethrow;
+ throw new SourceSpanFormatException(error.message, span);
+ }
}
/// Creates a [SourceSpan] for [node].
« no previous file with comments | « no previous file | lib/src/util/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698