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} ;
32
43fn assert_not_a_cargo_toml ( command : & str , manifest_path_argument : & str ) {
54 let p = project ( )
65 . file ( "Cargo.toml" , & basic_bin_manifest ( "foo" ) )
76 . file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
87 . build ( ) ;
98
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 (
1615 "[ERROR] the manifest-path must be a path \
1716 to a Cargo.toml file",
18- ) ,
19- ) ;
17+ ) . run ( ) ;
2018}
2119
2220fn 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) {
2624 . collect :: < Vec < _ > > ( )
2725 . join ( "[..]" ) ;
2826
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 ! (
3533 "[ERROR] manifest path `{}` does not exist" ,
3634 expected_path
37- ) ) ,
38- ) ;
35+ ) ) . run ( ) ;
3936}
4037
4138#[ test]
@@ -325,14 +322,13 @@ fn verify_project_dir_containing_cargo_toml() {
325322 . file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
326323 . build ( ) ;
327324
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 (
332329 "{\" invalid\" :\" the manifest-path must be a path to a Cargo.toml file\" }\
333330 ",
334- ) ,
335- ) ;
331+ ) . run ( ) ;
336332}
337333
338334#[ test]
@@ -342,14 +338,13 @@ fn verify_project_dir_plus_file() {
342338 . file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
343339 . build ( ) ;
344340
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 (
349345 "{\" invalid\" :\" the manifest-path must be a path to a Cargo.toml file\" }\
350346 ",
351- ) ,
352- ) ;
347+ ) . run ( ) ;
353348}
354349
355350#[ test]
@@ -359,25 +354,23 @@ fn verify_project_dir_plus_path() {
359354 . file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
360355 . build ( ) ;
361356
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 (
366361 "{\" invalid\" :\" the manifest-path must be a path to a Cargo.toml file\" }\
367362 ",
368- ) ,
369- ) ;
363+ ) . run ( ) ;
370364}
371365
372366#[ test]
373367fn verify_project_dir_to_nonexistent_cargo_toml ( ) {
374368 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 (
379373 "{\" invalid\" :\" manifest path `foo[..]bar[..]baz[..]Cargo.toml` does not exist\" }\
380374 ",
381- ) ,
382- ) ;
375+ ) . run ( ) ;
383376}
0 commit comments