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

Unified Diff: sdk/lib/_internal/pub/test/pubspec_test.dart

Issue 566093003: Create binstubs for executables when activating a package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise! Created 6 years, 3 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: 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..fec3077dcfa9e317ab64f11ccc806df775397a2c 100644
--- a/sdk/lib/_internal/pub/test/pubspec_test.dart
+++ b/sdk/lib/_internal/pub/test/pubspec_test.dart
@@ -444,5 +444,58 @@ 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("allows simple names for keys and most characters in values", () {
+ var pubspec = new Pubspec.parse('''
+executables:
+ abcDEF-123_: "abc DEF-123._"
+''', sources);
+ expect(pubspec.executables['abcDEF-123_'], equals('abc DEF-123._'));
+ });
+
+ 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 contains a path separator", () {
+ expectPubspecException('executables: {command: funny_name/part}',
+ (pubspec) => pubspec.executables);
+ });
+
+ test("throws if a value contains a windows path separator", () {
+ expectPubspecException(r'executables: {command: funny_name\part}',
+ (pubspec) => pubspec.executables);
+ });
+
+ test("uses the key if the value is null", () {
+ var pubspec = new Pubspec.parse('''
+executables:
+ command:
+''', sources);
+ expect(pubspec.executables['command'], equals('command'));
+ });
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698