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

Unified Diff: test/utils.dart

Issue 920703006: Add a Loader class for loading tests from files. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Code review changes Created 5 years, 10 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/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 f9b4075d70df066393024421491889b9a0561c3b..88845833403e09d084198bfe3d0158bb2ca9e606 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -6,6 +6,10 @@ library unittest.test.utils;
import 'dart:async';
import 'dart:collection';
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+import 'package:stack_trace/stack_trace.dart';
import 'package:unittest/src/live_test.dart';
import 'package:unittest/src/remote_exception.dart';
@@ -15,6 +19,13 @@ import 'package:unittest/unittest.dart';
// The last state change detected via [expectStates].
State lastState;
+final String packageDir = _computePackageDir();
+
+String _computePackageDir() {
+ var trace = new Trace.current();
+ return p.dirname(p.dirname(p.fromUri(trace.frames.first.uri)));
+}
+
/// Asserts that exactly [states] will be emitted via [liveTest.onStateChange].
///
/// The most recent emitted state is stored in [_lastState].
@@ -71,6 +82,12 @@ Matcher isRemoteException(String message) => predicate(
(error) => error is RemoteException && error.message == message,
'is a RemoteException with message "$message"');
+/// Returns a matcher that matches a [FileSystemException] with the given
+/// [message].
+Matcher isFileSystemException(String message) => predicate(
+ (error) => error is FileSystemException && error.message == message,
+ 'is a FileSystemException with message "$message"');
+
/// Returns a [Future] that completes after pumping the event queue [times]
/// times.
///
« no previous file with comments | « test/loader_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698