| Index: tests/isolate/scenarios/package_relative_root/package_relative_root_test.dart
|
| diff --git a/tests/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart b/tests/isolate/scenarios/package_relative_root/package_relative_root_test.dart
|
| similarity index 61%
|
| copy from tests/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
|
| copy to tests/isolate/scenarios/package_relative_root/package_relative_root_test.dart
|
| index e34c5b38ce2bd38ef60c07ec71d0c71a5f348d77..a3a853318a9d5baf79cc4124be13c1a34d19e3ff 100644
|
| --- a/tests/isolate/scenarios/automatic_resolution_spec/package_resolve_test.dart
|
| +++ b/tests/isolate/scenarios/package_relative_root/package_relative_root_test.dart
|
| @@ -1,53 +1,61 @@
|
| -// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +// PackageRoot=none
|
| +
|
| import 'dart:io';
|
| import 'dart:isolate';
|
|
|
| -final PACKAGE_URI = "package:foo/bar.dart";
|
| -final PACKAGE_PATH = "file:///no/such/directory/bar.dart";
|
| +import "package:foo/foo.dart";
|
| +import "package:bar/bar.dart";
|
| +
|
| +var CONFIG_URI = "package:bar/spawned_packages/";
|
|
|
| main([args, port]) async {
|
| if (port != null) {
|
| - testPackageResolution(port);
|
| + testCorrectBarPackage(port);
|
| return;
|
| }
|
| var p = new RawReceivePort();
|
| Isolate.spawnUri(Platform.script,
|
| [],
|
| p.sendPort,
|
| - automaticPackageResolution: true);
|
| + packageRoot: Uri.parse(CONFIG_URI));
|
| p.handler = (msg) {
|
| p.close();
|
| if (msg is! List) {
|
| print(msg.runtimeType);
|
| throw "Failure return from spawned isolate:\n\n$msg";
|
| }
|
| - var child_pkg_config = Platform.script.resolve(".packages");
|
| - if (msg[0] != child_pkg_config.toString()) {
|
| + if (msg[0] != "Foo") {
|
| throw "Bad package config in child isolate: ${msg[0]}\n"
|
| - "Expected: $child_pkg_config";
|
| + "Expected: 'Foo'";
|
| }
|
| - if (msg[1] != PACKAGE_PATH) {
|
| - throw "Package path not matching: ${msg[1]}";
|
| + if (msg[1] != "Bar2") {
|
| + throw "Package path not matching: ${msg[1]}\n"
|
| + "Expected: 'Bar2'";
|
| }
|
| print("SUCCESS");
|
| };
|
| - print("Spawning isolate's package root: ${await Isolate.packageRoot}");
|
| + if (Bar.value != "Bar1") {
|
| + throw "Spawning isolate package:bar invalid.";
|
| + }
|
| + print("Spawned isolate resolved $CONFIG_URI to: "
|
| + "${await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI))}");
|
| }
|
|
|
| -testPackageResolution(port) async {
|
| +testCorrectBarPackage(port) async {
|
| try {
|
| var packageRootStr = Platform.packageRoot;
|
| var packageConfigStr = Platform.packageConfig;
|
| var packageConfig = await Isolate.packageConfig;
|
| - var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(PACKAGE_URI));
|
| + var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI));
|
| print("Spawned isolate's package root flag: $packageRootStr");
|
| print("Spawned isolate's package config flag: $packageConfigStr");
|
| print("Spawned isolate's loaded package config: $packageConfig");
|
| print("Spawned isolate's resolved package path: $resolvedPkg");
|
| - port.send([packageConfig?.toString(), resolvedPkg?.toString()]);
|
| + port.send([Foo.value, Bar.value]);
|
| } catch (e, s) {
|
| port.send("$e\n$s\n");
|
| }
|
|
|