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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « .status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library unittest.test.io; 5 library unittest.test.io;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:mirrors';
8 9
9 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
10 import 'package:stack_trace/stack_trace.dart'; 11 import 'package:stack_trace/stack_trace.dart';
11 12
12 /// The root directory of the `unittest` package. 13 /// The root directory of the `unittest` package.
13 final String packageDir = _computePackageDir(); 14 final String packageDir = _computePackageDir();
14 String _computePackageDir() { 15 String _computePackageDir() =>
15 var trace = new Trace.current(); 16 p.dirname(p.dirname(_libraryPath(#unittest.test.io)));
16 return p.dirname(p.dirname(p.fromUri(trace.frames.first.uri)));
17 }
18 17
19 /// Runs the unittest executable with the package root set properly. 18 /// Runs the unittest executable with the package root set properly.
20 ProcessResult runUnittest(List<String> args, {String workingDirectory}) { 19 ProcessResult runUnittest(List<String> args, {String workingDirectory}) {
21 var allArgs = Platform.executableArguments.toList() 20 var allArgs = Platform.executableArguments.toList()
22 ..add(p.join(packageDir, 'bin/unittest.dart')) 21 ..add(p.join(packageDir, 'bin/unittest.dart'))
23 ..add("--package-root=${p.join(packageDir, 'packages')}") 22 ..add("--package-root=${p.join(packageDir, 'packages')}")
24 ..addAll(args); 23 ..addAll(args);
25 24
26 // TODO(nweiz): Use ScheduledProcess once it's compatible. 25 // TODO(nweiz): Use ScheduledProcess once it's compatible.
27 return Process.runSync(Platform.executable, allArgs, 26 return Process.runSync(Platform.executable, allArgs,
28 workingDirectory: workingDirectory); 27 workingDirectory: workingDirectory);
29 } 28 }
29
30 /// Returns the path to the library named [libraryName].
31 ///
32 /// The library name must be globally unique, or the wrong library path may be
33 /// 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.
34 /// declaration in the import above.
35 String _libraryPath(Symbol libraryName) {
36 var lib = currentMirrorSystem().findLibrary(libraryName);
37 return p.fromUri(lib.uri);
38 }
39
40
OLDNEW
« no previous file with comments | « .status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698