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

Unified Diff: tests/isolate/scenarios/short_package/short_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/short_package/short_package_test.dart
diff --git a/tests/isolate/scenarios/short_package/short_package_test.dart b/tests/isolate/scenarios/short_package/short_package_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bfbe61ca86f0238ae6b9cd6a5740ae1fa27e202e
--- /dev/null
+++ b/tests/isolate/scenarios/short_package/short_package_test.dart
@@ -0,0 +1,37 @@
+// 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';
+
+import "package:flu";
+
+var PACKAGE_FLU = "package:flu";
+var FLU_TEXT = "flu.text";
+
+testShortResolution(package_uri) async {
+ var fluPackage = await Isolate.resolvePackageUri(Uri.parse(package_uri));
+ print("Resolved $package_uri to $fluPackage");
+ var fluText = fluPackage.resolve(FLU_TEXT);
+ print("Resolved $FLU_TEXT from $package_uri to $fluText");
+ var fluFile = new File.fromUri(fluText);
+ var fluString = await fluFile.readAsString();
+ if (fluString != "Bar") {
+ throw "Contents of $FLU_TEXT not matching.\n"
+ "Got: $fluString\n"
+ "Expected: Bar";
+ }
+}
+
+main([args, port]) async {
+ if (Flu.value != "Flu") {
+ throw "Import of wrong Flu package.";
+ }
+ await testShortResolution(PACKAGE_FLU);
+ await testShortResolution(PACKAGE_FLU + "/");
+ await testShortResolution(PACKAGE_FLU + "/abc.def");
+ print("SUCCESS");
+}
« runtime/bin/builtin.dart ('K') | « tests/isolate/scenarios/short_package/flu_package/flu.text ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698