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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 -h, --help Print usage information for this command. | 80 -h, --help Print usage information for this command. |
81 --[no-]offline Use cached packages instead of accessing the net
work. | 81 --[no-]offline Use cached packages instead of accessing the net
work. |
82 '''); | 82 '''); |
83 }); | 83 }); |
84 | 84 |
85 integration('running pub with --help after a command with subcommands shows ' | 85 integration('running pub with --help after a command with subcommands shows ' |
86 'command usage', () { | 86 'command usage', () { |
87 schedulePub(args: ['cache', '--help'], | 87 schedulePub(args: ['cache', '--help'], |
88 output: ''' | 88 output: ''' |
89 Work with the system cache. | 89 Work with the system cache. |
90 | 90 |
91 Usage: pub cache <subcommand> | 91 Usage: pub cache <subcommand> |
92 -h, --help Print usage information for this command. | 92 -h, --help Print usage information for this command. |
93 | 93 |
94 Available subcommands: | 94 Available subcommands: |
95 add Install a package. | 95 add Install a package. |
96 '''); | 96 '''); |
97 }); | 97 }); |
98 | 98 |
99 | 99 |
100 integration('running pub with just --version displays version', () { | 100 integration('running pub with just --version displays version', () { |
101 schedulePub(args: ['--version'], output: VERSION_STRING); | 101 schedulePub(args: ['--version'], output: VERSION_STRING); |
102 }); | 102 }); |
103 | 103 |
104 integration('an unknown command displays an error message', () { | 104 integration('an unknown command displays an error message', () { |
105 schedulePub(args: ['quylthulg'], | 105 schedulePub(args: ['quylthulg'], |
106 error: ''' | 106 error: ''' |
107 Could not find a command named "quylthulg". | 107 Could not find a command named "quylthulg". |
108 | 108 |
109 Available commands: | 109 Available commands: |
110 build Apply transformers to build a package. | 110 build Apply transformers to build a package. |
111 cache Work with the system cache. | 111 cache Work with the system cache. |
112 get Get the current package's dependencies. | 112 get Get the current package's dependencies. |
113 help Display help information for Pub. | 113 help Display help information for Pub. |
114 publish Publish the current package to pub.dartlang.org. | 114 publish Publish the current package to pub.dartlang.org. |
115 serve Run a local web development server. | 115 serve Run a local web development server. |
116 upgrade Upgrade the current package's dependencies to latest versio
ns. | 116 upgrade Upgrade the current package's dependencies to latest versio
ns. |
117 uploader Manage uploaders for a package on pub.dartlang.org. | 117 uploader Manage uploaders for a package on pub.dartlang.org. |
118 version Print pub version. | 118 version Print pub version. |
119 ''', | 119 ''', |
120 exitCode: exit_codes.USAGE); | 120 exitCode: exit_codes.USAGE); |
121 }); | 121 }); |
122 | 122 |
123 integration('an unknown subcommand displays an error message', () { | 123 integration('an unknown subcommand displays an error message', () { |
124 schedulePub(args: ['cache', 'quylthulg'], | 124 schedulePub(args: ['cache', 'quylthulg'], |
125 error: ''' | 125 error: ''' |
126 Could not find a subcommand named "quylthulg" for "pub cache". | 126 Could not find a subcommand named "quylthulg" for "pub cache". |
127 | 127 |
128 Usage: pub cache <subcommand> | 128 Usage: pub cache <subcommand> |
129 -h, --help Print usage information for this command. | 129 -h, --help Print usage information for this command. |
130 | 130 |
131 Available subcommands: | 131 Available subcommands: |
132 add Install a package. | 132 add Install a package. |
133 ''', | 133 ''', |
134 exitCode: exit_codes.USAGE); | 134 exitCode: exit_codes.USAGE); |
135 }); | 135 }); |
136 | 136 |
137 integration('an unknown option displays an error message', () { | 137 integration('an unknown option displays an error message', () { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 --server The package server to which to upload this package. | 207 --server The package server to which to upload this package. |
208 (defaults to "https://pub.dartlang.org") | 208 (defaults to "https://pub.dartlang.org") |
209 '''); | 209 '''); |
210 }); | 210 }); |
211 | 211 |
212 integration('shows non-truncated help', () { | 212 integration('shows non-truncated help', () { |
213 schedulePub(args: ['help', 'serve'], | 213 schedulePub(args: ['help', 'serve'], |
214 output: ''' | 214 output: ''' |
215 Run a local web development server. | 215 Run a local web development server. |
216 | 216 |
217 By default, this serves "web/" and "test/", but an explicit list of | 217 By default, this serves "web/" and "test/", but an explicit list of |
218 directories to serve can be provided as well. | 218 directories to serve can be provided as well. |
219 | 219 |
220 Usage: pub serve [directories...] | 220 Usage: pub serve [directories...] |
221 -h, --help Print usage information for this command. | 221 -h, --help Print usage information for this command. |
| 222 --mode Mode to run transformers in. |
| 223 (defaults to "debug") |
| 224 |
| 225 --all Use all default source directories. |
222 --hostname The hostname to listen on. | 226 --hostname The hostname to listen on. |
223 (defaults to "localhost") | 227 (defaults to "localhost") |
224 | 228 |
225 --port The base port to listen on. | 229 --port The base port to listen on. |
226 (defaults to "8080") | 230 (defaults to "8080") |
227 | 231 |
228 --[no-]dart2js Compile Dart to JavaScript. | 232 --[no-]dart2js Compile Dart to JavaScript. |
229 (defaults to on) | 233 (defaults to on) |
230 | 234 |
231 --[no-]force-poll Force the use of a polling filesystem watch
er. | 235 --[no-]force-poll Force the use of a polling filesystem watch
er. |
232 --mode Mode to run transformers in. | |
233 (defaults to "debug") | |
234 '''); | 236 '''); |
235 }); | 237 }); |
236 | 238 |
237 integration('shows help for a subcommand', () { | 239 integration('shows help for a subcommand', () { |
238 schedulePub(args: ['help', 'cache', 'list'], | 240 schedulePub(args: ['help', 'cache', 'list'], |
239 output: ''' | 241 output: ''' |
240 List packages in the system cache. | 242 List packages in the system cache. |
241 | 243 |
242 Usage: pub cache list | 244 Usage: pub cache list |
243 -h, --help Print usage information for this command. | 245 -h, --help Print usage information for this command. |
(...skipping 19 matching lines...) Expand all Loading... |
263 exitCode: exit_codes.USAGE); | 265 exitCode: exit_codes.USAGE); |
264 }); | 266 }); |
265 | 267 |
266 integration('an unknown help subcommand displays an error message', () { | 268 integration('an unknown help subcommand displays an error message', () { |
267 schedulePub(args: ['help', 'cache', 'quylthulg'], | 269 schedulePub(args: ['help', 'cache', 'quylthulg'], |
268 error: ''' | 270 error: ''' |
269 Could not find a subcommand named "quylthulg" for "pub cache". | 271 Could not find a subcommand named "quylthulg" for "pub cache". |
270 | 272 |
271 Usage: pub cache <subcommand> | 273 Usage: pub cache <subcommand> |
272 -h, --help Print usage information for this command. | 274 -h, --help Print usage information for this command. |
273 | 275 |
274 Available subcommands: | 276 Available subcommands: |
275 add Install a package. | 277 add Install a package. |
276 ''', | 278 ''', |
277 exitCode: exit_codes.USAGE); | 279 exitCode: exit_codes.USAGE); |
278 }); | 280 }); |
279 | 281 |
280 integration('an unexpected help subcommand displays an error message', () { | 282 integration('an unexpected help subcommand displays an error message', () { |
281 schedulePub(args: ['help', 'version', 'badsubcommand'], | 283 schedulePub(args: ['help', 'version', 'badsubcommand'], |
282 error: ''' | 284 error: ''' |
283 Command "pub version" does not expect a subcommand. | 285 Command "pub version" does not expect a subcommand. |
284 | 286 |
285 Usage: pub version | 287 Usage: pub version |
286 -h, --help Print usage information for this command. | 288 -h, --help Print usage information for this command. |
287 ''', | 289 ''', |
288 exitCode: exit_codes.USAGE); | 290 exitCode: exit_codes.USAGE); |
289 }); | 291 }); |
290 }); | 292 }); |
291 | 293 |
292 group('version', () { | 294 group('version', () { |
293 integration('displays the current version', () { | 295 integration('displays the current version', () { |
294 schedulePub(args: ['version'], output: VERSION_STRING); | 296 schedulePub(args: ['version'], output: VERSION_STRING); |
295 }); | 297 }); |
296 }); | 298 }); |
297 } | 299 } |
OLD | NEW |