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

Unified Diff: test/io.dart

Issue 944553002: Fix the tests from the latest CL. (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
« no previous file with comments | « .status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/io.dart
diff --git a/test/io.dart b/test/io.dart
index 1dbc377eebf599728281be8e342a6657c3354061..76e61fa79a1f02302dbdbc2959a82bf6b698edec 100644
--- a/test/io.dart
+++ b/test/io.dart
@@ -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,15 @@ 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. Any libraries accessed must be added to the [MirrorsUsed]
kevmoo 2015/02/19 22:54:18 Remove the reference to MirrorsUsed.
nweiz 2015/02/19 23:17:44 Done.
+/// declaration in the import above.
+String _libraryPath(Symbol libraryName) {
+ var lib = currentMirrorSystem().findLibrary(libraryName);
+ return p.fromUri(lib.uri);
+}
+
+
« no previous file with comments | « .status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698