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. |
/// |