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

Unified Diff: test/io.dart

Issue 934413002: Replace the existing unittest APIs with the new runner infrastructure. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: 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
Index: test/io.dart
diff --git a/test/io.dart b/test/io.dart
index 663d454c11da659dba0ddfd96e81db6b0429d216..b1632347bd9fb3f36d389a880abde1d0b8f9b842 100644
--- a/test/io.dart
+++ b/test/io.dart
@@ -8,7 +8,6 @@ import 'dart:io';
import 'package:path/path.dart' as p;
import 'package:stack_trace/stack_trace.dart';
-import 'package:unittest/unittest.dart';
/// The root directory of the `unittest` package.
final String packageDir = _computePackageDir();
@@ -17,9 +16,22 @@ String _computePackageDir() {
return p.dirname(p.dirname(p.fromUri(trace.frames.first.uri)));
}
-/// 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"');
+/// Runs the unittest executable with the package root set properly.
+ProcessResult runUnittest(List<String> args, {String workingDirectory}) {
+ var allArgs = [
+ p.join(packageDir, 'bin/unittest.dart'),
+ "--package-root=${p.join(packageDir, 'packages')}"
+ ]..addAll(args);
+ // TODO(nweiz): Use ScheduledProcess once it's compatible.
+ return runDart(allArgs, workingDirectory: workingDirectory);
+}
+
+/// Runs Dart.
+ProcessResult runDart(List<String> args, {String workingDirectory}) {
+ var allArgs = Platform.executableArguments.toList()..addAll(args);
+
+ // TODO(nweiz): Use ScheduledProcess once it's compatible.
+ return Process.runSync(Platform.executable, allArgs,
+ workingDirectory: workingDirectory);
+}

Powered by Google App Engine
This is Rietveld 408576698