| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library('pub_tests'); | 5 #library('pub_tests'); |
| 6 | 6 |
| 7 #import('dart:io'); | 7 #import('dart:io'); |
| 8 | 8 |
| 9 #import('test_pub.dart'); | 9 #import('test_pub.dart'); |
| 10 #import('../../../pkg/unittest/unittest.dart'); | 10 #import('../../../pkg/unittest/unittest.dart'); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 apple 0.0.0 (apple from sdk) | 83 apple 0.0.0 (apple from sdk) |
| 84 banana 0.0.0 (banana from sdk) | 84 banana 0.0.0 (banana from sdk) |
| 85 cherry 0.0.0 (cherry from sdk) | 85 cherry 0.0.0 (cherry from sdk) |
| 86 '''); | 86 '''); |
| 87 }); | 87 }); |
| 88 }); | 88 }); |
| 89 */ | 89 */ |
| 90 } | 90 } |
| 91 | 91 |
| 92 installCommand() { | 92 installCommand() { |
| 93 group('requires', () { |
| 94 test('a pubspec', () { |
| 95 dir(appPath, []).scheduleCreate(); |
| 96 |
| 97 schedulePub(args: ['install'], |
| 98 error: const RegExp(@'^"pubspec.yaml" not found\.')); |
| 99 |
| 100 run(); |
| 101 }); |
| 102 |
| 103 test('a pubspec with a "name" key', () { |
| 104 dir(appPath, [ |
| 105 pubspec({"dependencies": {"foo": null}}) |
| 106 ]).scheduleCreate(); |
| 107 |
| 108 schedulePub(args: ['install'], |
| 109 error: const RegExp(@'^"pubspec.yaml" must contain a "name" key\.')); |
| 110 |
| 111 run(); |
| 112 }); |
| 113 }); |
| 114 |
| 115 test('creates a self-referential symlink', () { |
| 116 // The symlink should use the name in the pubspec, not the name of the |
| 117 // directory. |
| 118 dir(appPath, [ |
| 119 pubspec({"name": "myapp_name"}) |
| 120 ]).scheduleCreate(); |
| 121 |
| 122 schedulePub(args: ['install'], |
| 123 output: const RegExp(@"Dependencies installed!$")); |
| 124 |
| 125 dir(packagesPath, [ |
| 126 dir("myapp_name", [pubspec({"name": "myapp_name"})]) |
| 127 ]).scheduleValidate(); |
| 128 |
| 129 run(); |
| 130 }); |
| 131 |
| 93 test('checks out a package from the SDK', () { | 132 test('checks out a package from the SDK', () { |
| 94 dir(sdkPath, [ | 133 dir(sdkPath, [ |
| 95 file('revision', '1234'), | 134 file('revision', '1234'), |
| 96 dir('pkg', [packageDir("foo", "0.0.1234")]) | 135 dir('pkg', [packageDir("foo", "0.0.1234")]) |
| 97 ]).scheduleCreate(); | 136 ]).scheduleCreate(); |
| 98 | 137 |
| 99 dir(appPath, [ | 138 dir(appPath, [ |
| 100 pubspec({"dependencies": {"foo": null}}) | 139 pubspec({"name": "myapp", "dependencies": {"foo": null}}) |
| 101 ]).scheduleCreate(); | 140 ]).scheduleCreate(); |
| 102 | 141 |
| 103 schedulePub(args: ['install'], | 142 schedulePub(args: ['install'], |
| 104 output: ''' | 143 output: ''' |
| 105 Dependencies installed! | 144 Dependencies installed! |
| 106 '''); | 145 '''); |
| 107 | 146 |
| 108 packagesDir({"foo": "0.0.1234"}).scheduleValidate(); | 147 packagesDir({"foo": "0.0.1234"}).scheduleValidate(); |
| 109 | 148 |
| 110 run(); | 149 run(); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 "bar": "1.0.0", | 665 "bar": "1.0.0", |
| 627 "baz": "1.0.0", | 666 "baz": "1.0.0", |
| 628 "newdep": "2.0.0" | 667 "newdep": "2.0.0" |
| 629 }).scheduleValidate(); | 668 }).scheduleValidate(); |
| 630 | 669 |
| 631 run(); | 670 run(); |
| 632 }); | 671 }); |
| 633 } | 672 } |
| 634 | 673 |
| 635 updateCommand() { | 674 updateCommand() { |
| 675 group('requires', () { |
| 676 test('a pubspec', () { |
| 677 dir(appPath, []).scheduleCreate(); |
| 678 |
| 679 schedulePub(args: ['update'], |
| 680 error: const RegExp(@'^"pubspec.yaml" not found\.')); |
| 681 |
| 682 run(); |
| 683 }); |
| 684 |
| 685 test('a pubspec with a "name" key', () { |
| 686 dir(appPath, [ |
| 687 pubspec({"dependencies": {"foo": null}}) |
| 688 ]).scheduleCreate(); |
| 689 |
| 690 schedulePub(args: ['update'], |
| 691 error: const RegExp(@'^"pubspec.yaml" must contain a "name" key\.')); |
| 692 |
| 693 run(); |
| 694 }); |
| 695 }); |
| 696 |
| 636 test("updates locked Git packages", () { | 697 test("updates locked Git packages", () { |
| 637 ensureGit(); | 698 ensureGit(); |
| 638 | 699 |
| 639 git('foo.git', [ | 700 git('foo.git', [ |
| 640 file('foo.dart', 'main() => "foo";') | 701 file('foo.dart', 'main() => "foo";') |
| 641 ]).scheduleCreate(); | 702 ]).scheduleCreate(); |
| 642 | 703 |
| 643 git('bar.git', [ | 704 git('bar.git', [ |
| 644 file('bar.dart', 'main() => "bar";') | 705 file('bar.dart', 'main() => "bar";') |
| 645 ]).scheduleCreate(); | 706 ]).scheduleCreate(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 909 |
| 849 run(); | 910 run(); |
| 850 }); | 911 }); |
| 851 }); | 912 }); |
| 852 } | 913 } |
| 853 | 914 |
| 854 versionCommand() { | 915 versionCommand() { |
| 855 test('displays the current version', () => | 916 test('displays the current version', () => |
| 856 runPub(args: ['version'], output: VERSION_STRING)); | 917 runPub(args: ['version'], output: VERSION_STRING)); |
| 857 } | 918 } |
| OLD | NEW |