@@ -87,12 +87,12 @@ fn list_command_looks_at_path() {
87
87
"cargo-1" ,
88
88
& FakeKind :: Executable ,
89
89
) ;
90
- let mut pr = cargo_process ( ) ;
91
90
92
91
let mut path = path ( ) ;
93
92
path. push ( proj. root ( ) . join ( "path-test" ) ) ;
94
93
let path = env:: join_paths ( path. iter ( ) ) . unwrap ( ) ;
95
- let output = pr. arg ( "-v" ) . arg ( "--list" ) . env ( "PATH" , & path) ;
94
+ let mut p = cargo_process ( "-v --list" ) ;
95
+ let output = p. env ( "PATH" , & path) ;
96
96
let output = output. exec_with_output ( ) . unwrap ( ) ;
97
97
let output = str:: from_utf8 ( & output. stdout ) . unwrap ( ) ;
98
98
assert ! (
@@ -115,12 +115,12 @@ fn list_command_resolves_symlinks() {
115
115
target : & cargo_exe ( ) ,
116
116
} ,
117
117
) ;
118
- let mut pr = cargo_process ( ) ;
119
118
120
119
let mut path = path ( ) ;
121
120
path. push ( proj. root ( ) . join ( "path-test" ) ) ;
122
121
let path = env:: join_paths ( path. iter ( ) ) . unwrap ( ) ;
123
- let output = pr. arg ( "-v" ) . arg ( "--list" ) . env ( "PATH" , & path) ;
122
+ let mut p = cargo_process ( "-v --list" ) ;
123
+ let output = p. env ( "PATH" , & path) ;
124
124
let output = output. exec_with_output ( ) . unwrap ( ) ;
125
125
let output = str:: from_utf8 ( & output. stdout ) . unwrap ( ) ;
126
126
assert ! (
@@ -133,7 +133,7 @@ fn list_command_resolves_symlinks() {
133
133
#[ test]
134
134
fn find_closest_biuld_to_build ( ) {
135
135
assert_that (
136
- cargo_process ( ) . arg ( "biuld" ) ,
136
+ cargo_process ( "biuld" ) ,
137
137
execs ( ) . with_status ( 101 ) . with_stderr_contains (
138
138
"\
139
139
error: no such subcommand: `biuld`
@@ -157,17 +157,17 @@ error: no such subcommand: `biuld`
157
157
. publish ( ) ;
158
158
159
159
assert_that (
160
- cargo_process ( ) . arg ( "install" ) . arg ( " cargo-biuld") ,
160
+ cargo_process ( "install cargo-biuld" ) ,
161
161
execs ( ) . with_status ( 0 ) ,
162
162
) ;
163
163
assert_that (
164
- cargo_process ( ) . arg ( "biuld" ) ,
164
+ cargo_process ( "biuld" ) ,
165
165
execs ( )
166
166
. with_status ( 0 )
167
167
. with_stdout ( "Similar, but not identical to, build\n " ) ,
168
168
) ;
169
169
assert_that (
170
- cargo_process ( ) . arg ( "--list" ) ,
170
+ cargo_process ( "--list" ) ,
171
171
execs ( )
172
172
. with_status ( 0 )
173
173
. with_stdout_contains ( " build Compile a local package and all of its dependencies\n " )
@@ -178,12 +178,9 @@ error: no such subcommand: `biuld`
178
178
// if a subcommand is more than 3 edit distance away, we don't make a suggestion
179
179
#[ test]
180
180
fn find_closest_dont_correct_nonsense ( ) {
181
- let mut pr = cargo_process ( ) ;
182
- pr. arg ( "there-is-no-way-that-there-is-a-command-close-to-this" )
183
- . cwd ( & paths:: root ( ) ) ;
184
-
185
181
assert_that (
186
- pr,
182
+ cargo_process ( "there-is-no-way-that-there-is-a-command-close-to-this" )
183
+ . cwd ( & paths:: root ( ) ) ,
187
184
execs ( ) . with_status ( 101 ) . with_stderr (
188
185
"[ERROR] no such subcommand: \
189
186
`there-is-no-way-that-there-is-a-command-close-to-this`
@@ -194,15 +191,11 @@ fn find_closest_dont_correct_nonsense() {
194
191
195
192
#[ test]
196
193
fn displays_subcommand_on_error ( ) {
197
- let mut pr = cargo_process ( ) ;
198
- pr. arg ( "invalid-command" ) ;
199
-
200
194
assert_that (
201
- pr,
202
- execs ( ) . with_status ( 101 ) . with_stderr (
203
- "[ERROR] no such subcommand: `invalid-command`
204
- " ,
205
- ) ,
195
+ cargo_process ( "invalid-command" ) ,
196
+ execs ( )
197
+ . with_status ( 101 )
198
+ . with_stderr ( "[ERROR] no such subcommand: `invalid-command`\n " ) ,
206
199
) ;
207
200
}
208
201
@@ -224,11 +217,7 @@ fn override_cargo_home() {
224
217
. unwrap ( ) ;
225
218
226
219
assert_that (
227
- cargo_process ( )
228
- . arg ( "new" )
229
- . arg ( "foo" )
230
- . env ( "USER" , "foo" )
231
- . env ( "CARGO_HOME" , & my_home) ,
220
+ cargo_process ( "new foo" ) . env ( "USER" , "foo" ) . env ( "CARGO_HOME" , & my_home) ,
232
221
execs ( ) . with_status ( 0 ) ,
233
222
) ;
234
223
@@ -264,14 +253,13 @@ fn cargo_subcommand_env() {
264
253
assert_that ( p. cargo ( "build" ) , execs ( ) . with_status ( 0 ) ) ;
265
254
assert_that ( & p. bin ( "cargo-envtest" ) , existing_file ( ) ) ;
266
255
267
- let mut pr = cargo_process ( ) ;
268
256
let cargo = cargo_exe ( ) . canonicalize ( ) . unwrap ( ) ;
269
257
let mut path = path ( ) ;
270
258
path. push ( target_dir) ;
271
259
let path = env:: join_paths ( path. iter ( ) ) . unwrap ( ) ;
272
260
273
261
assert_that (
274
- pr . arg ( "envtest" ) . env ( "PATH" , & path) ,
262
+ cargo_process ( "envtest" ) . env ( "PATH" , & path) ,
275
263
execs ( ) . with_status ( 0 ) . with_stdout ( cargo. to_str ( ) . unwrap ( ) ) ,
276
264
) ;
277
265
}
@@ -300,12 +288,7 @@ fn cargo_subcommand_args() {
300
288
let path = env:: join_paths ( path. iter ( ) ) . unwrap ( ) ;
301
289
302
290
assert_that (
303
- cargo_process ( )
304
- . env ( "PATH" , & path)
305
- . arg ( "foo" )
306
- . arg ( "bar" )
307
- . arg ( "-v" )
308
- . arg ( "--help" ) ,
291
+ cargo_process ( "foo bar -v --help" ) . env ( "PATH" , & path) ,
309
292
execs ( ) . with_status ( 0 ) . with_stdout ( format ! (
310
293
r#"[{:?}, "foo", "bar", "-v", "--help"]"# ,
311
294
cargo_foo_bin
@@ -315,21 +298,12 @@ fn cargo_subcommand_args() {
315
298
316
299
#[ test]
317
300
fn cargo_help ( ) {
318
- assert_that ( cargo_process ( ) , execs ( ) . with_status ( 0 ) ) ;
319
- assert_that ( cargo_process ( ) . arg ( "help" ) , execs ( ) . with_status ( 0 ) ) ;
320
- assert_that ( cargo_process ( ) . arg ( "-h" ) , execs ( ) . with_status ( 0 ) ) ;
321
- assert_that (
322
- cargo_process ( ) . arg ( "help" ) . arg ( "build" ) ,
323
- execs ( ) . with_status ( 0 ) ,
324
- ) ;
325
- assert_that (
326
- cargo_process ( ) . arg ( "build" ) . arg ( "-h" ) ,
327
- execs ( ) . with_status ( 0 ) ,
328
- ) ;
329
- assert_that (
330
- cargo_process ( ) . arg ( "help" ) . arg ( "help" ) ,
331
- execs ( ) . with_status ( 0 ) ,
332
- ) ;
301
+ assert_that ( cargo_process ( "" ) , execs ( ) . with_status ( 0 ) ) ;
302
+ assert_that ( cargo_process ( "help" ) , execs ( ) . with_status ( 0 ) ) ;
303
+ assert_that ( cargo_process ( "-h" ) , execs ( ) . with_status ( 0 ) ) ;
304
+ assert_that ( cargo_process ( "help build" ) , execs ( ) . with_status ( 0 ) ) ;
305
+ assert_that ( cargo_process ( "build -h" ) , execs ( ) . with_status ( 0 ) ) ;
306
+ assert_that ( cargo_process ( "help help" ) , execs ( ) . with_status ( 0 ) ) ;
333
307
}
334
308
335
309
#[ test]
@@ -346,19 +320,19 @@ fn cargo_help_external_subcommand() {
346
320
)
347
321
. publish ( ) ;
348
322
assert_that (
349
- cargo_process ( ) . args ( & [ "install" , " cargo-fake-help"] ) ,
323
+ cargo_process ( "install cargo-fake-help" ) ,
350
324
execs ( ) . with_status ( 0 ) ,
351
325
) ;
352
326
assert_that (
353
- cargo_process ( ) . args ( & [ "help" , " fake-help"] ) ,
327
+ cargo_process ( "help fake-help" ) ,
354
328
execs ( ) . with_status ( 0 ) . with_stdout ( "fancy help output\n " )
355
329
) ;
356
330
}
357
331
358
332
#[ test]
359
333
fn explain ( ) {
360
334
assert_that (
361
- cargo_process ( ) . arg ( "--explain" ) . arg ( " E0001") ,
335
+ cargo_process ( "--explain E0001" ) ,
362
336
execs ( ) . with_status ( 0 ) . with_stdout_contains (
363
337
"This error suggests that the expression arm corresponding to the noted pattern" ,
364
338
) ,
@@ -370,7 +344,7 @@ fn explain() {
370
344
#[ test]
371
345
fn z_flags_help ( ) {
372
346
assert_that (
373
- cargo_process ( ) . arg ( "-Z" ) . arg ( " help") ,
347
+ cargo_process ( "-Z help" ) ,
374
348
execs ( ) . with_status ( 0 ) . with_stdout_contains (
375
349
" -Z unstable-options -- Allow the usage of unstable options such as --registry" ,
376
350
) ,
0 commit comments