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

Unified Diff: test/utils.dart

Issue 1055083004: Normalize handling of the package root in the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Unused import Created 5 years, 8 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 | « test/runner/loader_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/utils.dart
diff --git a/test/utils.dart b/test/utils.dart
index a05bff7a28d5a11b98a983f24eb57d1baa7c0f64..166b7ba868fd165cab37d2f16de2ea72ba9ecde2 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -12,6 +12,7 @@ import 'package:test/src/backend/live_test.dart';
import 'package:test/src/backend/metadata.dart';
import 'package:test/src/backend/state.dart';
import 'package:test/src/backend/suite.dart';
+import 'package:test/src/runner/application_exception.dart';
import 'package:test/src/runner/load_exception.dart';
import 'package:test/src/util/remote_exception.dart';
import 'package:test/test.dart';
@@ -168,6 +169,40 @@ class _IsLoadException extends Matcher {
}
}
+/// Returns a matcher that matches a [ApplicationException] with the given
+/// [message].
+///
+/// [message] can be a string or a [Matcher].
+Matcher isApplicationException(message) =>
+ new _IsApplicationException(wrapMatcher(message));
+
+class _IsApplicationException extends Matcher {
+ final Matcher _message;
+
+ _IsApplicationException(this._message);
+
+ bool matches(item, Map matchState) =>
+ item is ApplicationException && _message.matches(item.message, matchState);
+
+ Description describe(Description description) =>
+ description.add('a ApplicationException with message ')
+ .addDescriptionOf(_message);
+
+ Description describeMismatch(item, Description mismatchDescription,
+ Map matchState, bool verbose) {
+ if (item is! ApplicationException) {
+ return mismatchDescription.addDescriptionOf(item)
+ .add('is not a ApplicationException');
+ } else {
+ return mismatchDescription
+ .add('message ')
+ .addDescriptionOf(item)
+ .add(' is not ')
+ .addDescriptionOf(_message);
+ }
+ }
+}
+
/// Returns a [Future] that completes after pumping the event queue [times]
/// times.
///
« no previous file with comments | « test/runner/loader_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698