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

Unified Diff: test/current_isolate_info_test.dart

Issue 2224203002: Fix current_isolate_info_test. (Closed) Base URL: git@github.com:dart-lang/package_resolver@master
Patch Set: Created 4 years, 4 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 | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/current_isolate_info_test.dart
diff --git a/test/current_isolate_info_test.dart b/test/current_isolate_info_test.dart
index bb6f4f7d93389eaa3d5c5387817449cc66e8f152..5da0ff444290797114b4baece2ee93e27bb47706 100644
--- a/test/current_isolate_info_test.dart
+++ b/test/current_isolate_info_test.dart
@@ -12,6 +12,7 @@ import 'package:stack_trace/stack_trace.dart';
import 'package:test/test.dart';
import 'package:package_resolver/package_resolver.dart';
+import 'package:package_resolver/src/utils.dart';
void main() {
// It's important to test these, because they use PackageConfig.current and
@@ -38,12 +39,12 @@ void main() {
} else {
// If the isolate running this test isn't using package config, create
// one from scratch with the same resolution semantics.
- var map = {};
+ map = {};
var root = p.fromUri(await PackageResolver.current.packageRoot);
await for (var link in new Directory(root).list(followLinks: false)) {
assert(link is Link);
map[p.basename(link.path)] =
- p.toUri(await link.resolveSymbolicLinks());
+ ensureTrailingSlash(p.toUri((await link.resolveSymbolicLinks())));
}
}
@@ -188,11 +189,22 @@ void main() {
});
}
-Future<String> get _packageResolverLibUri async =>
- (await PackageResolver.current.urlFor("package_resolver")).toString();
+Future<String> get _packageResolverLibUri => _urlForPackage('package_resolver');
-Future<String> get _pathLibUri async =>
- (await PackageResolver.current.urlFor("path")).toString();
+Future<String> get _pathLibUri => _urlForPackage('path');
+
+Future<String> _urlForPackage(String package) async {
+ var uri = await PackageResolver.current.urlFor(package);
+ if (await PackageResolver.current.packageConfigMap != null) {
+ return uri.toString();
+ }
+
+ // If we're using a package root, we resolve the symlinks in the test code so
+ // we need to resolve them here as well to ensure we're testing against the
+ // same values.
+ var resolved = new Directory(p.fromUri(uri)).resolveSymbolicLinksSync();
+ return ensureTrailingSlash(p.toUri(resolved)).toString();
+}
Future _spawn(String expression, PackageResolver packageResolver) async {
var data = new UriData.fromString("""
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698