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

Unified Diff: test/no_package_info_test.dart

Issue 2132443003: Add package implementation. (Closed) Base URL: git@github.com:dart-lang/package_resolver@master
Patch Set: Created 4 years, 5 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: test/no_package_info_test.dart
diff --git a/test/no_package_info_test.dart b/test/no_package_info_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..11ad083ad759167db72c62503b6fe0f4a23bbf10
--- /dev/null
+++ b/test/no_package_info_test.dart
@@ -0,0 +1,44 @@
+// 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.
+
+import 'package:test/test.dart';
+
+import 'package:package_resolver/package_resolver.dart';
+
+void main() {
+ var resolver;
+ setUp(() {
+ resolver = SyncPackageResolver.none;
+ });
+
+ test("exposes everything as null", () {
+ expect(resolver.packageConfigMap, isNull);
+ expect(resolver.packageConfigUri, isNull);
+ expect(resolver.packageRoot, isNull);
+ expect(resolver.processArgument, isNull);
+ expect(resolver.resolveUri("package:foo/bar.dart"), isNull);
+ expect(resolver.urlFor("foo"), isNull);
+ expect(resolver.urlFor("foo", "bar.dart"), isNull);
+ expect(resolver.packageUriFor("file:///foo/bar.dart"), isNull);
+ expect(resolver.packagePath("foo"), isNull);
+ });
+
+ group("resolveUri", () {
+ test("with an invalid argument type", () {
+ expect(() => resolver.resolveUri(12), throwsArgumentError);
+ });
+
+ test("with a non-package URI", () {
+ expect(() => resolver.resolveUri("file:///zip/zap"), throwsFormatException);
Bob Nystrom 2016/07/21 18:00:32 Long line.
nweiz 2016/07/21 19:42:43 Done.
+ });
+
+ test("with an invalid package URI", () {
+ expect(() => resolver.resolveUri("package:"), throwsFormatException);
+ });
+ });
+
+ test("packageUriFor with an invalid argument type", () {
+ expect(() => resolver.packageUriFor(12), throwsArgumentError);
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698