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 'package:scheduled_test/scheduled_test.dart'; | 7 import 'package:scheduled_test/scheduled_test.dart'; |
8 | 8 |
9 import 'descriptor.dart' as d; | 9 import 'descriptor.dart' as d; |
10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
11 | 11 |
12 main() { | 12 main() { |
13 initConfig(); | 13 initConfig(); |
14 | 14 |
15 forBothPubInstallAndUpdate((command) { | 15 forBothPubInstallAndUpdate((command) { |
16 group('requires', () { | 16 group('requires', () { |
17 integration('a pubspec', () { | 17 integration('a pubspec', () { |
18 d.dir(appPath, []).create(); | 18 d.dir(appPath, []).create(); |
19 | 19 |
20 pubCommand(command, | 20 pubCommand(command, |
21 error: new RegExp(r'^Could not find a file named "pubspec.yaml" ' | 21 error: new RegExp(r'Could not find a file named "pubspec.yaml" ' |
22 r'in the directory .*\.$')); | 22 r'in "[^\n]*"\.')); |
23 }); | 23 }); |
24 | 24 |
25 integration('a pubspec with a "name" key', () { | 25 integration('a pubspec with a "name" key', () { |
26 d.dir(appPath, [ | 26 d.dir(appPath, [ |
27 d.pubspec({"dependencies": {"foo": null}}) | 27 d.pubspec({"dependencies": {"foo": null}}) |
28 ]).create(); | 28 ]).create(); |
29 | 29 |
30 pubCommand(command, error: | 30 pubCommand(command, error: new RegExp(r'Missing the required "name" ' |
31 'pubspec.yaml is missing the required "name" field ' | 31 r'field\.')); |
32 '(e.g. "name: myapp").'); | |
33 }); | 32 }); |
34 }); | 33 }); |
35 | 34 |
36 integration('adds itself to the packages', () { | 35 integration('adds itself to the packages', () { |
37 // The symlink should use the name in the pubspec, not the name of the | 36 // The symlink should use the name in the pubspec, not the name of the |
38 // directory. | 37 // directory. |
39 d.dir(appPath, [ | 38 d.dir(appPath, [ |
40 d.pubspec({"name": "myapp_name"}), | 39 d.pubspec({"name": "myapp_name"}), |
41 d.libDir('myapp_name') | 40 d.libDir('myapp_name') |
42 ]).create(); | 41 ]).create(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 error: new RegExp("^Incompatible dependencies on 'baz':\n")); | 113 error: new RegExp("^Incompatible dependencies on 'baz':\n")); |
115 }); | 114 }); |
116 | 115 |
117 integration('does not allow a dependency on itself', () { | 116 integration('does not allow a dependency on itself', () { |
118 d.dir(appPath, [ | 117 d.dir(appPath, [ |
119 d.appPubspec({ | 118 d.appPubspec({ |
120 "myapp": {"path": "."} | 119 "myapp": {"path": "."} |
121 }) | 120 }) |
122 ]).create(); | 121 ]).create(); |
123 | 122 |
124 pubCommand(command, | 123 pubCommand(command, error: new RegExp(r'"dependencies.myapp": Package ' |
125 error: new RegExp("Package 'myapp' cannot depend on itself.")); | 124 r'may not list itself as a dependency\.')); |
126 }); | 125 }); |
127 | 126 |
128 integration('does not allow a dev dependency on itself', () { | 127 integration('does not allow a dev dependency on itself', () { |
129 d.dir(appPath, [ | 128 d.dir(appPath, [ |
130 d.pubspec({ | 129 d.pubspec({ |
131 "name": "myapp", | 130 "name": "myapp", |
132 "dev_dependencies": { | 131 "dev_dependencies": { |
133 "myapp": {"path": "."} | 132 "myapp": {"path": "."} |
134 } | 133 } |
135 }) | 134 }) |
136 ]).create(); | 135 ]).create(); |
137 | 136 |
138 pubCommand(command, | 137 pubCommand(command, error: new RegExp(r'"dev_dependencies.myapp": ' |
139 error: new RegExp("Package 'myapp' cannot depend on itself.")); | 138 r'Package may not list itself as a dependency\.')); |
140 }); | 139 }); |
141 }); | 140 }); |
142 } | 141 } |
OLD | NEW |