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 import 'package:pub/src/exit_codes.dart' as exit_codes; | 5 import 'package:pub/src/exit_codes.dart' as exit_codes; |
6 import 'package:scheduled_test/scheduled_test.dart'; | 6 import 'package:scheduled_test/scheduled_test.dart'; |
7 | 7 |
8 import 'descriptor.dart' as d; | 8 import 'descriptor.dart' as d; |
9 import 'test_pub.dart'; | 9 import 'test_pub.dart'; |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 d.dir(appPath, [ | 23 d.dir(appPath, [ |
24 d.pubspec({"dependencies": {"foo": null}}) | 24 d.pubspec({"dependencies": {"foo": null}}) |
25 ]).create(); | 25 ]).create(); |
26 | 26 |
27 pubCommand(command, | 27 pubCommand(command, |
28 error: contains('Missing the required "name" field.'), | 28 error: contains('Missing the required "name" field.'), |
29 exitCode: exit_codes.DATA); | 29 exitCode: exit_codes.DATA); |
30 }); | 30 }); |
31 }); | 31 }); |
32 | 32 |
33 integration('adds itself to the packages', () { | 33 integration('adds itself to the packages directory and .packages file', () { |
34 // The symlink should use the name in the pubspec, not the name of the | 34 // The package should use the name in the pubspec, not the name of the |
35 // directory. | 35 // directory. |
36 d.dir(appPath, [ | 36 d.dir(appPath, [ |
37 d.pubspec({"name": "myapp_name"}), | 37 d.pubspec({"name": "myapp_name"}), |
38 d.libDir('myapp_name') | 38 d.libDir('myapp_name') |
39 ]).create(); | 39 ]).create(); |
40 | 40 |
41 pubCommand(command); | 41 pubCommand(command, args: ["--packages-dir"]); |
42 | 42 |
43 d.dir(packagesPath, [ | 43 d.dir(packagesPath, [ |
44 d.dir("myapp_name", [ | 44 d.dir("myapp_name", [ |
45 d.file('myapp_name.dart', 'main() => "myapp_name";') | 45 d.file('myapp_name.dart', 'main() => "myapp_name";') |
46 ]) | 46 ]) |
| 47 ]).validate(); |
| 48 |
| 49 d.dir("myapp", [ |
| 50 d.packagesFile({ |
| 51 "myapp_name": "." |
| 52 }) |
47 ]).validate(); | 53 ]).validate(); |
48 }); | 54 }); |
49 | 55 |
50 integration('does not adds itself to the packages if it has no "lib" ' | 56 integration('does not adds itself to the packages if it has no "lib" ' |
51 'directory', () { | 57 'directory', () { |
52 // The symlink should use the name in the pubspec, not the name of the | 58 // The symlink should use the name in the pubspec, not the name of the |
53 // directory. | 59 // directory. |
54 d.dir(appPath, [ | 60 d.dir(appPath, [ |
55 d.pubspec({"name": "myapp_name"}), | 61 d.pubspec({"name": "myapp_name"}), |
56 ]).create(); | 62 ]).create(); |
57 | 63 |
58 pubCommand(command); | 64 pubCommand(command, args: ["--packages-dir"]); |
59 | 65 |
60 d.dir(packagesPath, [ | 66 d.dir(packagesPath, [ |
61 d.nothing("myapp_name") | 67 d.nothing("myapp_name") |
62 ]).validate(); | 68 ]).validate(); |
63 }); | 69 }); |
64 | 70 |
65 integration('does not add a package if it does not have a "lib" ' | 71 integration('does not add a package if it does not have a "lib" ' |
66 'directory', () { | 72 'directory', () { |
67 // Using a path source, but this should be true of all sources. | 73 // Using a path source, but this should be true of all sources. |
68 d.dir('foo', [ | 74 d.dir('foo', [ |
69 d.libPubspec('foo', '0.0.0-not.used') | 75 d.libPubspec('foo', '0.0.0-not.used') |
70 ]).create(); | 76 ]).create(); |
71 | 77 |
72 d.dir(appPath, [ | 78 d.dir(appPath, [ |
73 d.appPubspec({"foo": {"path": "../foo"}}) | 79 d.appPubspec({"foo": {"path": "../foo"}}) |
74 ]).create(); | 80 ]).create(); |
75 | 81 |
76 pubCommand(command); | 82 pubCommand(command, args: ["--packages-dir"]); |
77 | 83 |
78 d.packagesDir({"foo": null}).validate(); | 84 d.packagesDir({"foo": null}).validate(); |
79 }); | 85 }); |
80 | 86 |
81 integration('reports a solver failure', () { | 87 integration('reports a solver failure', () { |
82 // myapp depends on foo and bar which both depend on baz with mismatched | 88 // myapp depends on foo and bar which both depend on baz with mismatched |
83 // descriptions. | 89 // descriptions. |
84 d.dir('deps', [ | 90 d.dir('deps', [ |
85 d.dir('foo', [ | 91 d.dir('foo', [ |
86 d.pubspec({"name": "foo", "dependencies": { | 92 d.pubspec({"name": "foo", "dependencies": { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 138 } |
133 }) | 139 }) |
134 ]).create(); | 140 ]).create(); |
135 | 141 |
136 pubCommand(command, | 142 pubCommand(command, |
137 error: contains('A package may not list itself as a dependency.'), | 143 error: contains('A package may not list itself as a dependency.'), |
138 exitCode: exit_codes.DATA); | 144 exitCode: exit_codes.DATA); |
139 }); | 145 }); |
140 }); | 146 }); |
141 } | 147 } |
OLD | NEW |