File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 11
11
extern crate assert_cli;
12
12
13
13
use std:: collections:: { HashMap , HashSet } ;
14
+ use std:: env;
14
15
use std:: fs;
15
16
use std:: io:: { self , BufRead , BufReader , Read } ;
16
17
use std:: iter:: { Enumerate , Peekable } ;
@@ -892,14 +893,19 @@ impl Drop for TempFile {
892
893
}
893
894
}
894
895
896
+ fn rustfmt ( ) -> PathBuf {
897
+ let mut me = env:: current_exe ( ) . expect ( "failed to get current executable" ) ;
898
+ me. pop ( ) ; // chop of the test name
899
+ me. pop ( ) ; // chop off `deps`
900
+ me. push ( "rustfmt" ) ;
901
+ return me;
902
+ }
903
+
895
904
#[ test]
896
905
fn verify_check_works ( ) {
897
906
let temp_file = make_temp_file ( "temp_check.rs" ) ;
898
907
assert_cli:: Assert :: command ( & [
899
- "cargo" ,
900
- "run" ,
901
- "--bin=rustfmt" ,
902
- "--" ,
908
+ rustfmt ( ) . to_str ( ) . unwrap ( ) ,
903
909
"--write-mode=check" ,
904
910
temp_file. path . to_str ( ) . unwrap ( ) ,
905
911
] ) . succeeds ( )
@@ -910,10 +916,7 @@ fn verify_check_works() {
910
916
fn verify_diff_works ( ) {
911
917
let temp_file = make_temp_file ( "temp_diff.rs" ) ;
912
918
assert_cli:: Assert :: command ( & [
913
- "cargo" ,
914
- "run" ,
915
- "--bin=rustfmt" ,
916
- "--" ,
919
+ rustfmt ( ) . to_str ( ) . unwrap ( ) ,
917
920
"--write-mode=diff" ,
918
921
temp_file. path . to_str ( ) . unwrap ( ) ,
919
922
] ) . succeeds ( )
You can’t perform that action at this time.
0 commit comments