Chromium Code Reviews| 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 e34ce431c0d2dca1bc1c859c4d3f1d7fe5b1fd4c..63c7df4f02472fb62c0a3a90e83ada97e6285778 100644 |
| --- a/sdk/lib/_internal/pub/test/pubspec_test.dart |
| +++ b/sdk/lib/_internal/pub/test/pubspec_test.dart |
| @@ -444,5 +444,45 @@ publish_to: none |
| (pubspec) => pubspec.publishTo); |
| }); |
| }); |
| + |
| + group("executables", () { |
| + test("defaults to an empty map if omitted", () { |
| + var pubspec = new Pubspec.parse('', sources); |
| + expect(pubspec.executables, isEmpty); |
| + }); |
| + |
| + test("throws if not a map", () { |
| + expectPubspecException('executables: not map', |
| + (pubspec) => pubspec.executables); |
| + }); |
| + |
| + test("throws if key is not a string", () { |
| + expectPubspecException('executables: {123: value}', |
| + (pubspec) => pubspec.executables); |
| + }); |
| + |
| + test("throws if a key isn't a simple name", () { |
| + expectPubspecException('executables: {funny/name: ok}', |
| + (pubspec) => pubspec.executables); |
| + }); |
| + |
| + test("throws if a value is not a string", () { |
| + expectPubspecException('executables: {command: 123}', |
| + (pubspec) => pubspec.executables); |
| + }); |
| + |
| + test("throws if a value isn't a simple name", () { |
| + expectPubspecException('executables: {command: funny_name/part}', |
| + (pubspec) => pubspec.executables); |
| + }); |
| + |
| + test("allows a null value", () { |
| + var pubspec = new Pubspec.parse(''' |
| +executables: |
| + command: |
| +''', sources); |
| + expect(pubspec.executables['command'], isNull); |
|
nweiz
2014/09/15 22:57:18
I feel like this should normalize to return the co
Bob Nystrom
2014/09/17 21:34:35
Done.
|
| + }); |
| + }); |
| }); |
| } |