@@ -194,12 +194,6 @@ mod tests {
194
194
use ignore:: gitignore:: GitignoreBuilder ;
195
195
use std:: env;
196
196
197
- fn path_to_buf ( root : & str , file_name : & str ) -> PathBuf {
198
- let mut path = PathBuf :: from ( root) ;
199
- path. push ( file_name) ;
200
- path
201
- }
202
-
203
197
#[ test]
204
198
fn test_filter_ignored_files ( ) {
205
199
let current_dir = env:: current_dir ( ) . unwrap ( ) ;
@@ -209,8 +203,8 @@ mod tests {
209
203
. unwrap ( )
210
204
. build ( )
211
205
. unwrap ( ) ;
212
- let should_remain = path_to_buf ( current_dir. to_str ( ) . unwrap ( ) , "record.text" ) ;
213
- let should_filter = path_to_buf ( current_dir. to_str ( ) . unwrap ( ) , "index.html" ) ;
206
+ let should_remain = current_dir. join ( "record.text" ) ;
207
+ let should_filter = current_dir. join ( "index.html" ) ;
214
208
215
209
let remain = filter_ignored_files ( ignore, & [ should_remain. clone ( ) , should_filter] ) ;
216
210
assert_eq ! ( remain, vec![ should_remain] )
@@ -226,9 +220,9 @@ mod tests {
226
220
. build ( )
227
221
. unwrap ( ) ;
228
222
229
- let parent_dir = format ! ( "{}/../" , current_dir . to_str ( ) . unwrap ( ) ) ;
230
- let should_remain = path_to_buf ( & parent_dir, "record.text" ) ;
231
- let should_filter = path_to_buf ( & parent_dir, "index.html" ) ;
223
+ let parent_dir = current_dir . join ( ".." ) ;
224
+ let should_remain = parent_dir. join ( "record.text" ) ;
225
+ let should_filter = parent_dir. join ( "index.html" ) ;
232
226
233
227
let remain = filter_ignored_files ( ignore, & [ should_remain. clone ( ) , should_filter] ) ;
234
228
assert_eq ! ( remain, vec![ should_remain] )
0 commit comments