File tree Expand file tree Collapse file tree 5 files changed +18
-29
lines changed Expand file tree Collapse file tree 5 files changed +18
-29
lines changed Original file line number Diff line number Diff line change 1- use assert_cmd:: cargo:: CommandCargoExt ;
2- use elaborate:: std:: { env:: var_wc, process :: CommandContext } ;
1+ use assert_cmd:: cargo:: cargo_bin_cmd ;
2+ use elaborate:: std:: env:: var_wc;
33use std:: {
44 io:: { Write , stderr} ,
5- process:: Command ,
65 sync:: Mutex ,
76} ;
87
@@ -15,21 +14,19 @@ fn dogfood() {
1514 let _lock = MUTEX . lock ( ) . unwrap ( ) ;
1615
1716 preserves_cleanliness ( "dogfood" , || {
18- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
17+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
1918 command. arg ( "src/**/*.rs" ) ;
20- let status = command. status_wc ( ) . unwrap ( ) ;
21- assert ! ( status. success( ) ) ;
19+ command. assert ( ) . success ( ) ;
2220 } ) ;
2321}
2422
2523#[ test]
2624fn dogfood_with_check ( ) {
2725 let _lock = MUTEX . lock ( ) . unwrap ( ) ;
2826
29- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
27+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
3028 command. args ( [ "src/**/*.rs" , "--check" ] ) ;
31- let status = command. status_wc ( ) . unwrap ( ) ;
32- assert ! ( status. success( ) ) ;
29+ command. assert ( ) . success ( ) ;
3330}
3431
3532fn preserves_cleanliness ( test_name : & str , f : impl FnOnce ( ) ) {
Original file line number Diff line number Diff line change 1- use assert_cmd:: { assert :: OutputAssertExt , cargo:: CommandCargoExt } ;
1+ use assert_cmd:: cargo:: cargo_bin_cmd ;
22use elaborate:: std:: fs:: read_to_string_wc;
33use predicates:: prelude:: * ;
4- use std:: process:: Command ;
54
65mod util;
76
87#[ test]
98fn globstar ( ) {
109 let ( _tempdir, path) = util:: copy_into_tempdir ( "fixtures/globstar" ) . unwrap ( ) ;
1110
12- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
11+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
1312 command. arg ( "**/*.rs" ) ;
1413 command. current_dir ( & path) ;
1514 command. assert ( ) . success ( ) ;
@@ -20,7 +19,7 @@ fn globstar() {
2019
2120#[ test]
2221fn globstar_with_check ( ) {
23- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
22+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
2423 command. args ( [ "**/*.rs" , "--check" ] ) ;
2524 command. current_dir ( "fixtures/globstar" ) ;
2625 command. assert ( ) . failure ( ) . stderr ( predicate:: eq (
Original file line number Diff line number Diff line change 1- use assert_cmd:: { assert :: OutputAssertExt , cargo:: CommandCargoExt } ;
1+ use assert_cmd:: cargo:: cargo_bin_cmd ;
22use predicates:: prelude:: * ;
3- use std:: process:: Command ;
43use tempfile:: tempdir;
54
65#[ test]
76fn nonexistent_file ( ) {
87 let tempdir = tempdir ( ) . unwrap ( ) ;
98
10- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
9+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
1110 command. arg ( "nonexistent_file.rs" ) ;
1211 command. current_dir ( & tempdir) ;
1312 command. assert ( ) . failure ( ) . stderr ( predicate:: eq (
Original file line number Diff line number Diff line change 1- use assert_cmd:: { assert :: OutputAssertExt , cargo:: CommandCargoExt } ;
1+ use assert_cmd:: cargo:: cargo_bin_cmd ;
22use elaborate:: std:: fs:: read_to_string_wc;
33use predicates:: prelude:: * ;
44use similar_asserts:: SimpleDiff ;
5- use std:: process:: Command ;
65
76mod util;
87
@@ -12,7 +11,7 @@ fn rustfmt_toml_in_parent_directory() {
1211
1312 let src_dir = path. join ( "src" ) ;
1413
15- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
14+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
1615 command. arg ( "main.rs" ) ;
1716 command. current_dir ( & src_dir) ;
1817 command. assert ( ) . success ( ) ;
@@ -28,7 +27,7 @@ fn rustfmt_toml_in_parent_directory() {
2827
2928#[ test]
3029fn rustfmt_toml_in_parent_directory_with_check ( ) {
31- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
30+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
3231 command. args ( [ "main.rs" , "--check" ] ) ;
3332 command. current_dir ( "fixtures/clippy_issue_14274/src" ) ;
3433 command. assert ( ) . failure ( ) . stderr ( predicate:: eq (
Original file line number Diff line number Diff line change 11use anyhow:: Result ;
2- use assert_cmd:: cargo:: CommandCargoExt ;
3- use elaborate:: std:: {
4- fs:: { create_dir_wc, write_wc} ,
5- process:: CommandContext ,
6- } ;
2+ use assert_cmd:: cargo:: cargo_bin_cmd;
3+ use elaborate:: std:: fs:: { create_dir_wc, write_wc} ;
74use std:: {
85 fs:: remove_dir_all,
96 io,
107 path:: { Path , PathBuf } ,
11- process:: Command ,
128 sync:: atomic:: { AtomicBool , Ordering } ,
139 thread,
1410} ;
@@ -52,11 +48,10 @@ fn race() {
5248
5349 for i in 0 ..N_ITERATIONS {
5450 dbg ! ( i) ;
55- let mut command = Command :: cargo_bin ( "rustdoc-prettier" ) . unwrap ( ) ;
51+ let mut command = cargo_bin_cmd ! ( "rustdoc-prettier" ) ;
5652 command. arg ( "**/*.rs" ) ;
5753 command. current_dir ( & tempdir) ;
58- let status = command. status_wc ( ) . unwrap ( ) ;
59- assert ! ( status. success( ) ) ;
54+ command. assert ( ) . success ( ) ;
6055 }
6156
6257 EXIT . store ( true , Ordering :: SeqCst ) ;
You can’t perform that action at this time.
0 commit comments