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