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 '../lib/src/exit_codes.dart' as exit_codes; |
10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 [all] Show all output including internal tracing messages. | 23 [all] Show all output including internal tracing messages. |
24 [io] Also show IO operations. | 24 [io] Also show IO operations. |
25 [normal] Show errors, warnings, and user messages. | 25 [normal] Show errors, warnings, and user messages. |
26 [solver] Show steps during version resolution. | 26 [solver] Show steps during version resolution. |
27 | 27 |
28 -v, --verbose Shortcut for "--verbosity=all". | 28 -v, --verbose Shortcut for "--verbosity=all". |
29 | 29 |
30 Available commands: | 30 Available commands: |
31 build Apply transformers to build a package. | 31 build Apply transformers to build a package. |
| 32 cache Work with the system cache. |
32 get Get the current package's dependencies. | 33 get Get the current package's dependencies. |
33 help Display help information for Pub. | 34 help Display help information for Pub. |
34 publish Publish the current package to pub.dartlang.org. | 35 publish Publish the current package to pub.dartlang.org. |
35 serve Run a local web development server. | 36 serve Run a local web development server. |
36 upgrade Upgrade the current package's dependencies to latest versions. | 37 upgrade Upgrade the current package's dependencies to latest versions. |
37 uploader Manage uploaders for a package on pub.dartlang.org. | 38 uploader Manage uploaders for a package on pub.dartlang.org. |
38 version Print pub version. | 39 version Print pub version. |
39 | 40 |
40 Use "pub help [command]" for more information about a command. | 41 Use "pub help [command]" for more information about a command. |
41 """; | 42 """; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 integration('running pub with --help after a command with subcommands shows ' | 85 integration('running pub with --help after a command with subcommands shows ' |
85 'command usage', () { | 86 'command usage', () { |
86 schedulePub(args: ['cache', '--help'], | 87 schedulePub(args: ['cache', '--help'], |
87 output: ''' | 88 output: ''' |
88 Work with the system cache. | 89 Work with the system cache. |
89 | 90 |
90 Usage: pub cache <subcommand> | 91 Usage: pub cache <subcommand> |
91 -h, --help Print usage information for this command. | 92 -h, --help Print usage information for this command. |
92 | 93 |
93 Available subcommands: | 94 Available subcommands: |
94 list List packages in the system cache. | 95 add Install a package. |
95 '''); | 96 '''); |
96 }); | 97 }); |
97 | 98 |
98 | 99 |
99 integration('running pub with just --version displays version', () { | 100 integration('running pub with just --version displays version', () { |
100 schedulePub(args: ['--version'], output: VERSION_STRING); | 101 schedulePub(args: ['--version'], output: VERSION_STRING); |
101 }); | 102 }); |
102 | 103 |
103 integration('an unknown command displays an error message', () { | 104 integration('an unknown command displays an error message', () { |
104 schedulePub(args: ['quylthulg'], | 105 schedulePub(args: ['quylthulg'], |
105 error: ''' | 106 error: ''' |
106 Could not find a command named "quylthulg". | 107 Could not find a command named "quylthulg". |
107 | 108 |
108 Available commands: | 109 Available commands: |
109 build Apply transformers to build a package. | 110 build Apply transformers to build a package. |
| 111 cache Work with the system cache. |
110 get Get the current package's dependencies. | 112 get Get the current package's dependencies. |
111 help Display help information for Pub. | 113 help Display help information for Pub. |
112 publish Publish the current package to pub.dartlang.org. | 114 publish Publish the current package to pub.dartlang.org. |
113 serve Run a local web development server. | 115 serve Run a local web development server. |
114 upgrade Upgrade the current package's dependencies to latest versio
ns. | 116 upgrade Upgrade the current package's dependencies to latest versio
ns. |
115 uploader Manage uploaders for a package on pub.dartlang.org. | 117 uploader Manage uploaders for a package on pub.dartlang.org. |
116 version Print pub version. | 118 version Print pub version. |
117 ''', | 119 ''', |
118 exitCode: exit_codes.USAGE); | 120 exitCode: exit_codes.USAGE); |
119 }); | 121 }); |
120 | 122 |
121 integration('an unknown subcommand displays an error message', () { | 123 integration('an unknown subcommand displays an error message', () { |
122 schedulePub(args: ['cache', 'quylthulg'], | 124 schedulePub(args: ['cache', 'quylthulg'], |
123 error: ''' | 125 error: ''' |
124 Could not find a subcommand named "quylthulg" for "pub cache". | 126 Could not find a subcommand named "quylthulg" for "pub cache". |
125 | 127 |
126 Usage: pub cache <subcommand> | 128 Usage: pub cache <subcommand> |
127 -h, --help Print usage information for this command. | 129 -h, --help Print usage information for this command. |
128 | 130 |
129 Available subcommands: | 131 Available subcommands: |
130 list List packages in the system cache. | 132 add Install a package. |
131 ''', | 133 ''', |
132 exitCode: exit_codes.USAGE); | 134 exitCode: exit_codes.USAGE); |
133 }); | 135 }); |
134 | 136 |
135 integration('an unknown option displays an error message', () { | 137 integration('an unknown option displays an error message', () { |
136 schedulePub(args: ['--blorf'], | 138 schedulePub(args: ['--blorf'], |
137 error: ''' | 139 error: ''' |
138 Could not find an option named "blorf". | 140 Could not find an option named "blorf". |
139 Run "pub help" to see available options. | 141 Run "pub help" to see available options. |
140 ''', | 142 ''', |
(...skipping 24 matching lines...) Expand all Loading... |
165 | 167 |
166 integration('a missing subcommand displays an error message', () { | 168 integration('a missing subcommand displays an error message', () { |
167 schedulePub(args: ['cache'], | 169 schedulePub(args: ['cache'], |
168 error: ''' | 170 error: ''' |
169 Missing subcommand for "pub cache". | 171 Missing subcommand for "pub cache". |
170 | 172 |
171 Usage: pub cache <subcommand> | 173 Usage: pub cache <subcommand> |
172 -h, --help Print usage information for this command. | 174 -h, --help Print usage information for this command. |
173 | 175 |
174 Available subcommands: | 176 Available subcommands: |
175 list List packages in the system cache. | 177 add Install a package. |
176 ''', | 178 ''', |
177 exitCode: exit_codes.USAGE); | 179 exitCode: exit_codes.USAGE); |
178 }); | 180 }); |
179 | 181 |
180 group('help', () { | 182 group('help', () { |
181 integration('shows global help if no command is given', () { | 183 integration('shows global help if no command is given', () { |
182 schedulePub(args: ['help'], output: USAGE_STRING); | 184 schedulePub(args: ['help'], output: USAGE_STRING); |
183 }); | 185 }); |
184 | 186 |
185 integration('shows help for a command', () { | 187 integration('shows help for a command', () { |
(...skipping 28 matching lines...) Expand all Loading... |
214 | 216 |
215 Usage: pub cache list | 217 Usage: pub cache list |
216 -h, --help Print usage information for this command. | 218 -h, --help Print usage information for this command. |
217 '''); | 219 '''); |
218 }); | 220 }); |
219 | 221 |
220 integration('an unknown help command displays an error message', () { | 222 integration('an unknown help command displays an error message', () { |
221 schedulePub(args: ['help', 'quylthulg'], | 223 schedulePub(args: ['help', 'quylthulg'], |
222 error: ''' | 224 error: ''' |
223 Could not find a command named "quylthulg". | 225 Could not find a command named "quylthulg". |
224 | 226 |
225 Available commands: | 227 Available commands: |
226 build Apply transformers to build a package. | 228 build Apply transformers to build a package. |
| 229 cache Work with the system cache. |
227 get Get the current package's dependencies. | 230 get Get the current package's dependencies. |
228 help Display help information for Pub. | 231 help Display help information for Pub. |
229 publish Publish the current package to pub.dartlang.org. | 232 publish Publish the current package to pub.dartlang.org. |
230 serve Run a local web development server. | 233 serve Run a local web development server. |
231 upgrade Upgrade the current package's dependencies to latest ve
rsions. | 234 upgrade Upgrade the current package's dependencies to latest ve
rsions. |
232 uploader Manage uploaders for a package on pub.dartlang.org. | 235 uploader Manage uploaders for a package on pub.dartlang.org. |
233 version Print pub version. | 236 version Print pub version. |
234 ''', | 237 ''', |
235 exitCode: exit_codes.USAGE); | 238 exitCode: exit_codes.USAGE); |
236 }); | 239 }); |
237 | 240 |
238 integration('an unknown help subcommand displays an error message', () { | 241 integration('an unknown help subcommand displays an error message', () { |
239 schedulePub(args: ['help', 'cache', 'quylthulg'], | 242 schedulePub(args: ['help', 'cache', 'quylthulg'], |
240 error: ''' | 243 error: ''' |
241 Could not find a subcommand named "quylthulg" for "pub cache". | 244 Could not find a subcommand named "quylthulg" for "pub cache". |
242 | 245 |
243 Usage: pub cache <subcommand> | 246 Usage: pub cache <subcommand> |
244 -h, --help Print usage information for this command. | 247 -h, --help Print usage information for this command. |
245 | 248 |
246 Available subcommands: | 249 Available subcommands: |
247 list List packages in the system cache. | 250 add Install a package. |
248 ''', | 251 ''', |
249 exitCode: exit_codes.USAGE); | 252 exitCode: exit_codes.USAGE); |
250 }); | 253 }); |
251 | 254 |
252 integration('an unexpected help subcommand displays an error message', () { | 255 integration('an unexpected help subcommand displays an error message', () { |
253 schedulePub(args: ['help', 'version', 'badsubcommand'], | 256 schedulePub(args: ['help', 'version', 'badsubcommand'], |
254 error: ''' | 257 error: ''' |
255 Command "pub version" does not expect a subcommand. | 258 Command "pub version" does not expect a subcommand. |
256 | 259 |
257 Usage: pub version | 260 Usage: pub version |
258 -h, --help Print usage information for this command. | 261 -h, --help Print usage information for this command. |
259 ''', | 262 ''', |
260 exitCode: exit_codes.USAGE); | 263 exitCode: exit_codes.USAGE); |
261 }); | 264 }); |
262 }); | 265 }); |
263 | 266 |
264 group('version', () { | 267 group('version', () { |
265 integration('displays the current version', () { | 268 integration('displays the current version', () { |
266 schedulePub(args: ['version'], output: VERSION_STRING); | 269 schedulePub(args: ['version'], output: VERSION_STRING); |
267 }); | 270 }); |
268 }); | 271 }); |
269 } | 272 } |
OLD | NEW |