@@ -194,12 +194,6 @@ mod tests {
194194 use ignore:: gitignore:: GitignoreBuilder ;
195195 use std:: env;
196196
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-
203197 #[ test]
204198 fn test_filter_ignored_files ( ) {
205199 let current_dir = env:: current_dir ( ) . unwrap ( ) ;
@@ -209,8 +203,8 @@ mod tests {
209203 . unwrap ( )
210204 . build ( )
211205 . 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" ) ;
214208
215209 let remain = filter_ignored_files ( ignore, & [ should_remain. clone ( ) , should_filter] ) ;
216210 assert_eq ! ( remain, vec![ should_remain] )
@@ -226,9 +220,9 @@ mod tests {
226220 . build ( )
227221 . unwrap ( ) ;
228222
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" ) ;
232226
233227 let remain = filter_ignored_files ( ignore, & [ should_remain. clone ( ) , should_filter] ) ;
234228 assert_eq ! ( remain, vec![ should_remain] )
0 commit comments