File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ use diffutilslib::assert_diff_eq;
88use predicates:: prelude:: * ;
99use std:: fs:: File ;
1010use std:: io:: Write ;
11- use std:: path:: PathBuf ;
12- use tempfile:: NamedTempFile ;
11+ use tempfile:: { tempdir, NamedTempFile } ;
1312
1413// Integration tests for the diffutils command
1514
@@ -238,14 +237,13 @@ fn read_from_stdin() -> Result<(), Box<dyn std::error::Error>> {
238237}
239238
240239#[ test]
241- fn read_from_directory ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
242- let target = PathBuf :: from ( "target/integration" ) ;
243- let _ = std:: fs:: create_dir ( & target) ;
240+ fn compare_file_to_directory ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
241+ let tmp_dir = tempdir ( ) ?;
244242
245- let directory = target . join ( "d" ) ;
243+ let directory = tmp_dir . path ( ) . join ( "d" ) ;
246244 let _ = std:: fs:: create_dir ( & directory) ;
247245
248- let a_path = target . join ( "a" ) ;
246+ let a_path = tmp_dir . path ( ) . join ( "a" ) ;
249247 let mut a = File :: create ( & a_path) . unwrap ( ) ;
250248 a. write_all ( b"a\n " ) . unwrap ( ) ;
251249
You can’t perform that action at this time.
0 commit comments