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

Unified Diff: tests/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart

Issue 1822863002: - Properly return null if an unknown package is resolved. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 4 years, 9 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
Index: tests/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
diff --git a/tests/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart b/tests/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
similarity index 59%
copy from tests/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
copy to tests/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
index e22d3ef49428e1737792a44550e5002122c33f7e..c8017e1e7f743a988e0b4ab4c9d0bae8b63d31dd 100644
--- a/tests/isolate/scenarios/package_relative_spec/package_relative_spec_test.dart
+++ b/tests/isolate/scenarios/bad_resolve_package/bad_resolve_package_test.dart
@@ -7,55 +7,40 @@
import 'dart:io';
import 'dart:isolate';
-import "package:foo/foo.dart";
-import "package:bar/bar.dart";
-
-var CONFIG_URI = "package:bar/package.config";
-
main([args, port]) async {
if (port != null) {
- testCorrectBarPackage(port);
+ testBadResolvePackage(port);
return;
}
var p = new RawReceivePort();
- Isolate.spawnUri(Platform.script,
- [],
- p.sendPort,
- packageConfig: Uri.parse(CONFIG_URI));
+ Isolate.spawnUri(Platform.script, [], p.sendPort);
p.handler = (msg) {
p.close();
if (msg is! List) {
print(msg.runtimeType);
throw "Failure return from spawned isolate:\n\n$msg";
}
- if (msg[0] != "Foo") {
+ // Expecting a null resolution for inexistent package mapping.
+ if (msg[0] != null) {
throw "Bad package config in child isolate: ${msg[0]}\n"
"Expected: 'Foo'";
}
- if (msg[1] != "Bar2") {
- throw "Package path not matching: ${msg[1]}\n"
- "Expected: 'Bar2'";
- }
print("SUCCESS");
};
- if (Bar.value != "Bar1") {
- throw "Spawning isolate package:bar invalid.";
- }
- print("Spawned isolate resolved $CONFIG_URI to: "
- "${await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI))}");
}
-testCorrectBarPackage(port) async {
+testBadResolvePackage(port) async {
try {
var packageRootStr = Platform.packageRoot;
var packageConfigStr = Platform.packageConfig;
var packageConfig = await Isolate.packageConfig;
- var resolvedPkg = await Isolate.resolvePackageUri(Uri.parse(CONFIG_URI));
+ var badPackageUri = Uri.parse("package:asdf/qwerty.dart");
+ var resolvedPkg = await Isolate.resolvePackageUri(badPackageUri);
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([Foo.value, Bar.value]);
+ port.send([resolvedPkg]);
} catch (e, s) {
port.send("$e\n$s\n");
}

Powered by Google App Engine
This is Rietveld 408576698