Skip to content
Snippets Groups Projects
Commit 612ca3a0 authored by Natalie Weizenbaum's avatar Natalie Weizenbaum
Browse files

Fix the tests from the latest CL.

This ensures that console_reporter_test isn't run on browsers, and
improves the path detection for test/io.dart.

R=kevmoo@google.com

Review URL: https://codereview.chromium.org//944553002
parent 533b58ce
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ lib/*/*/*/*: SkipByDesign
# dart:io-specific tests.
[ $browser ]
test/console_reporter_test: SkipByDesign
test/loader_test: SkipByDesign
test/runner_test: SkipByDesign
test/vm_listener_test: SkipByDesign
......
......@@ -5,16 +5,15 @@
library unittest.test.io;
import 'dart:io';
import 'dart:mirrors';
import 'package:path/path.dart' as p;
import 'package:stack_trace/stack_trace.dart';
/// The root directory of the `unittest` package.
final String packageDir = _computePackageDir();
String _computePackageDir() {
var trace = new Trace.current();
return p.dirname(p.dirname(p.fromUri(trace.frames.first.uri)));
}
String _computePackageDir() =>
p.dirname(p.dirname(_libraryPath(#unittest.test.io)));
/// Runs the unittest executable with the package root set properly.
ProcessResult runUnittest(List<String> args, {String workingDirectory}) {
......@@ -27,3 +26,14 @@ ProcessResult runUnittest(List<String> args, {String workingDirectory}) {
return Process.runSync(Platform.executable, allArgs,
workingDirectory: workingDirectory);
}
/// Returns the path to the library named [libraryName].
///
/// The library name must be globally unique, or the wrong library path may be
/// returned.
String _libraryPath(Symbol libraryName) {
var lib = currentMirrorSystem().findLibrary(libraryName);
return p.fromUri(lib.uri);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment