Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

Commit

Permalink
Fix current_isolate_info_test.
Browse files Browse the repository at this point in the history
This test didn't actually work when run with a package root rather than
a package config, as is the case in Google-internal tests.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org//2224203002 .
  • Loading branch information
nex3 committed Aug 8, 2016
1 parent 0b63bf3 commit 8a70d3e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 1.0.1

* Internal changes only.

## 1.0.0

* Initial version.
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: package_resolver
version: 1.0.0
version: 1.0.1
description: First-class package resolution strategy classes.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/package_resolver
Expand Down
24 changes: 18 additions & 6 deletions test/current_isolate_info_test.dart
Expand Up @@ -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
Expand All @@ -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())));
}
}

Expand Down Expand Up @@ -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("""
Expand Down

0 comments on commit 8a70d3e

Please sign in to comment.