Index: sdk/lib/_internal/pub/test/pubspec_test.dart |
diff --git a/sdk/lib/_internal/pub/test/pubspec_test.dart b/sdk/lib/_internal/pub/test/pubspec_test.dart |
index f451f1fb1edfe9c315c91999a8f876bd7f351828..344e6b7975b839948b61674c5fc0f8bea667de11 100644 |
--- a/sdk/lib/_internal/pub/test/pubspec_test.dart |
+++ b/sdk/lib/_internal/pub/test/pubspec_test.dart |
@@ -241,13 +241,13 @@ dependencies: |
'"transformers.pkg" field must be a map'); |
}); |
- test("throws if a transformer's configuration contains a top-level key " |
- "beginning with a dollar sign", () { |
+ test("throws if a transformer's configuration contains an unknown " |
+ "reserved key at the top level", () { |
expectPubspecException(''' |
name: pkg |
transformers: [{pkg: {\$key: "value"}}]''', |
(pubspec) => pubspec.transformers, |
- '"transformers.pkg" field cannot contain reserved field "\$key"'); |
+ 'Unknown reserved field "\$key"'); |
nweiz
2014/02/24 21:42:46
This is a much worse error message than before. It
Bob Nystrom
2014/02/26 01:09:41
Done. The paths were always in the error message,
|
}); |
test("doesn't throw if a transformer's configuration contains a " |
@@ -262,6 +262,44 @@ transformers: |
expect(pkg.configuration["outer"]["\$inner"], equals("value")); |
}); |
+ test("throws if the \$include value is not a string or list", () { |
+ expectPubspecException(''' |
+name: pkg |
+transformers: |
+- pkg: {\$include: 123}''', |
+ (pubspec) => pubspec.transformers, |
+ '"\$include" field must be a string or list, but was "123"'); |
+ }); |
+ |
+ test("throws if the \$include list contains a non-string", () { |
+ expectPubspecException(''' |
+name: pkg |
+transformers: |
+- pkg: {\$include: ["ok", 123, "alright", null]}''', |
+ (pubspec) => pubspec.transformers, |
+ '"\$include" list field may only contain strings, but contained ' |
+ '"123" and "null"'); |
+ }); |
+ |
+ test("throws if the \$exclude value is not a string or list", () { |
+ expectPubspecException(''' |
+name: pkg |
+transformers: |
+- pkg: {\$exclude: 123}''', |
+ (pubspec) => pubspec.transformers, |
+ '"\$exclude" field must be a string or list, but was "123"'); |
+ }); |
+ |
+ test("throws if the \$exclude list contains a non-string", () { |
+ expectPubspecException(''' |
+name: pkg |
+transformers: |
+- pkg: {\$exclude: ["ok", 123, "alright", null]}''', |
+ (pubspec) => pubspec.transformers, |
+ '"\$exclude" list field may only contain strings, but contained ' |
+ '"123" and "null"'); |
+ }); |
+ |
test("throws if a transformer is not from a dependency", () { |
expectPubspecException(''' |
name: pkg |