1
- use support:: { basic_bin_manifest, execs, main_file, project} ;
2
- use support:: hamcrest:: assert_that;
1
+ use support:: { basic_bin_manifest, main_file, project} ;
3
2
4
3
fn assert_not_a_cargo_toml ( command : & str , manifest_path_argument : & str ) {
5
4
let p = project ( )
6
5
. file ( "Cargo.toml" , & basic_bin_manifest ( "foo" ) )
7
6
. file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
8
7
. build ( ) ;
9
8
10
- assert_that (
11
- p . cargo ( command )
12
- . arg ( "--manifest-path" )
13
- . arg ( manifest_path_argument )
14
- . cwd ( p . root ( ) . parent ( ) . unwrap ( ) ) ,
15
- execs ( ) . with_status ( 101 ) . with_stderr (
9
+ p . cargo ( command )
10
+ . arg ( "--manifest-path" )
11
+ . arg ( manifest_path_argument )
12
+ . cwd ( p . root ( ) . parent ( ) . unwrap ( ) )
13
+ . with_status ( 101 )
14
+ . with_stderr (
16
15
"[ERROR] the manifest-path must be a path \
17
16
to a Cargo.toml file",
18
- ) ,
19
- ) ;
17
+ ) . run ( ) ;
20
18
}
21
19
22
20
fn assert_cargo_toml_doesnt_exist ( command : & str , manifest_path_argument : & str ) {
@@ -26,16 +24,15 @@ fn assert_cargo_toml_doesnt_exist(command: &str, manifest_path_argument: &str) {
26
24
. collect :: < Vec < _ > > ( )
27
25
. join ( "[..]" ) ;
28
26
29
- assert_that (
30
- p . cargo ( command )
31
- . arg ( "--manifest-path" )
32
- . arg ( manifest_path_argument )
33
- . cwd ( p . root ( ) . parent ( ) . unwrap ( ) ) ,
34
- execs ( ) . with_status ( 101 ) . with_stderr ( format ! (
27
+ p . cargo ( command )
28
+ . arg ( "--manifest-path" )
29
+ . arg ( manifest_path_argument )
30
+ . cwd ( p . root ( ) . parent ( ) . unwrap ( ) )
31
+ . with_status ( 101 )
32
+ . with_stderr ( format ! (
35
33
"[ERROR] manifest path `{}` does not exist" ,
36
34
expected_path
37
- ) ) ,
38
- ) ;
35
+ ) ) . run ( ) ;
39
36
}
40
37
41
38
#[ test]
@@ -325,14 +322,13 @@ fn verify_project_dir_containing_cargo_toml() {
325
322
. file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
326
323
. build ( ) ;
327
324
328
- assert_that (
329
- p . cargo ( "verify-project --manifest-path foo" )
330
- . cwd ( p . root ( ) . parent ( ) . unwrap ( ) ) ,
331
- execs ( ) . with_status ( 1 ) . with_stdout (
325
+ p . cargo ( "verify-project --manifest-path foo" )
326
+ . cwd ( p . root ( ) . parent ( ) . unwrap ( ) )
327
+ . with_status ( 1 )
328
+ . with_stdout (
332
329
"{\" invalid\" :\" the manifest-path must be a path to a Cargo.toml file\" }\
333
330
",
334
- ) ,
335
- ) ;
331
+ ) . run ( ) ;
336
332
}
337
333
338
334
#[ test]
@@ -342,14 +338,13 @@ fn verify_project_dir_plus_file() {
342
338
. file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
343
339
. build ( ) ;
344
340
345
- assert_that (
346
- p . cargo ( "verify-project --manifest-path foo/bar" )
347
- . cwd ( p . root ( ) . parent ( ) . unwrap ( ) ) ,
348
- execs ( ) . with_status ( 1 ) . with_stdout (
341
+ p . cargo ( "verify-project --manifest-path foo/bar" )
342
+ . cwd ( p . root ( ) . parent ( ) . unwrap ( ) )
343
+ . with_status ( 1 )
344
+ . with_stdout (
349
345
"{\" invalid\" :\" the manifest-path must be a path to a Cargo.toml file\" }\
350
346
",
351
- ) ,
352
- ) ;
347
+ ) . run ( ) ;
353
348
}
354
349
355
350
#[ test]
@@ -359,25 +354,23 @@ fn verify_project_dir_plus_path() {
359
354
. file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
360
355
. build ( ) ;
361
356
362
- assert_that (
363
- p . cargo ( "verify-project --manifest-path foo/bar/baz" )
364
- . cwd ( p . root ( ) . parent ( ) . unwrap ( ) ) ,
365
- execs ( ) . with_status ( 1 ) . with_stdout (
357
+ p . cargo ( "verify-project --manifest-path foo/bar/baz" )
358
+ . cwd ( p . root ( ) . parent ( ) . unwrap ( ) )
359
+ . with_status ( 1 )
360
+ . with_stdout (
366
361
"{\" invalid\" :\" the manifest-path must be a path to a Cargo.toml file\" }\
367
362
",
368
- ) ,
369
- ) ;
363
+ ) . run ( ) ;
370
364
}
371
365
372
366
#[ test]
373
367
fn verify_project_dir_to_nonexistent_cargo_toml ( ) {
374
368
let p = project ( ) . build ( ) ;
375
- assert_that (
376
- p . cargo ( "verify-project --manifest-path foo/bar/baz/Cargo.toml" )
377
- . cwd ( p . root ( ) . parent ( ) . unwrap ( ) ) ,
378
- execs ( ) . with_status ( 1 ) . with_stdout (
369
+ p . cargo ( "verify-project --manifest-path foo/bar/baz/Cargo.toml" )
370
+ . cwd ( p . root ( ) . parent ( ) . unwrap ( ) )
371
+ . with_status ( 1 )
372
+ . with_stdout (
379
373
"{\" invalid\" :\" manifest path `foo[..]bar[..]baz[..]Cargo.toml` does not exist\" }\
380
374
",
381
- ) ,
382
- ) ;
375
+ ) . run ( ) ;
383
376
}
0 commit comments