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

Side by Side Diff: sdk/lib/_internal/pub_generated/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library pubspec_test; 1 library pubspec_test;
2 import 'dart:async'; 2 import 'dart:async';
3 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
4 import '../lib/src/package.dart'; 4 import '../lib/src/package.dart';
5 import '../lib/src/pubspec.dart'; 5 import '../lib/src/pubspec.dart';
6 import '../lib/src/source.dart'; 6 import '../lib/src/source.dart';
7 import '../lib/src/source_registry.dart'; 7 import '../lib/src/source_registry.dart';
8 import '../lib/src/version.dart'; 8 import '../lib/src/version.dart';
9 import 'test_pub.dart'; 9 import 'test_pub.dart';
10 class MockSource extends Source { 10 class MockSource extends Source {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 publish_to: none 379 publish_to: none
380 ''', sources); 380 ''', sources);
381 expect(pubspec.publishTo, equals("none")); 381 expect(pubspec.publishTo, equals("none"));
382 }); 382 });
383 test("throws on other strings", () { 383 test("throws on other strings", () {
384 expectPubspecException( 384 expectPubspecException(
385 'publish_to: http://bad.url:not-port', 385 'publish_to: http://bad.url:not-port',
386 (pubspec) => pubspec.publishTo); 386 (pubspec) => pubspec.publishTo);
387 }); 387 });
388 }); 388 });
389 group("executables", () {
390 test("defaults to an empty map if omitted", () {
391 var pubspec = new Pubspec.parse('', sources);
392 expect(pubspec.executables, isEmpty);
393 });
394 test("allows simple names for keys and most characters in values", () {
395 var pubspec = new Pubspec.parse('''
396 executables:
397 abcDEF-123_: "abc DEF-123._"
398 ''', sources);
399 expect(pubspec.executables['abcDEF-123_'], equals('abc DEF-123._'));
400 });
401 test("throws if not a map", () {
402 expectPubspecException(
403 'executables: not map',
404 (pubspec) => pubspec.executables);
405 });
406 test("throws if key is not a string", () {
407 expectPubspecException(
408 'executables: {123: value}',
409 (pubspec) => pubspec.executables);
410 });
411 test("throws if a key isn't a simple name", () {
412 expectPubspecException(
413 'executables: {funny/name: ok}',
414 (pubspec) => pubspec.executables);
415 });
416 test("throws if a value is not a string", () {
417 expectPubspecException(
418 'executables: {command: 123}',
419 (pubspec) => pubspec.executables);
420 });
421 test("throws if a value contains a path separator", () {
422 expectPubspecException(
423 'executables: {command: funny_name/part}',
424 (pubspec) => pubspec.executables);
425 });
426 test("throws if a value contains a windows path separator", () {
427 expectPubspecException(
428 r'executables: {command: funny_name\part}',
429 (pubspec) => pubspec.executables);
430 });
431 test("uses the key if the value is null", () {
432 var pubspec = new Pubspec.parse('''
433 executables:
434 command:
435 ''', sources);
436 expect(pubspec.executables['command'], equals('command'));
437 });
438 });
389 }); 439 });
390 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698