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

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

Issue 1027193004: Respect top-level @TestOn declarations. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Add another test. 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
Index: lib/src/runner/load_exception.dart
diff --git a/lib/src/runner/load_exception.dart b/lib/src/runner/load_exception.dart
index f2bc2f1ef8daa460b6367554e611703b42a194ca..99f5285e1fe9dd444f7412ffb45e6334c9c13430 100644
--- a/lib/src/runner/load_exception.dart
+++ b/lib/src/runner/load_exception.dart
@@ -7,6 +7,7 @@ library unittest.runner.load_exception;
import 'dart:isolate';
import 'package:path/path.dart' as p;
+import 'package:source_span/source_span.dart';
import '../utils.dart';
@@ -17,8 +18,11 @@ class LoadException implements Exception {
LoadException(this.path, this.innerError);
- String toString() {
- var buffer = new StringBuffer('Failed to load "$path":');
+ String toString({bool color: false}) {
+ var buffer = new StringBuffer();
+ if (color) buffer.write('\u001b[31m'); // red
+ buffer.write('Failed to load "$path":');
+ if (color) buffer.write('\u001b[0m'); // no color
var innerString = getErrorMessage(innerError);
if (innerError is IsolateSpawnException) {
@@ -33,6 +37,9 @@ class LoadException implements Exception {
"Uncaught Error: Load Error: FileSystemException: ",
"");
innerString = innerString.split("Stack Trace:\n").first.trim();
+ } if (innerError is SourceSpanException) {
+ innerString = innerError.toString(color: color)
+ .replaceFirst(" of $path", "");
}
buffer.write(innerString.contains("\n") ? "\n" : " ");

Powered by Google App Engine
This is Rietveld 408576698