@@ -223,10 +223,10 @@ fn contains_tmcnosubmit(entry: &DirEntry) -> bool {
223223
224224#[ cfg( test) ]
225225mod test {
226- /*
227226 use super :: * ;
228227 use crate :: policy:: EverythingIsStudentFilePolicy ;
229228 use std:: collections:: HashSet ;
229+ use std:: fs:: { self , * } ;
230230 use tempfile:: tempdir;
231231
232232 fn init ( ) {
@@ -258,12 +258,9 @@ mod test {
258258 File :: create ( missing_file_path) . unwrap ( ) ;
259259
260260 let path = temp. path ( ) . join ( "exercise-name" ) ;
261- let zipped = zip(
262- Box::new(EverythingIsStudentFilePolicy::new(path.clone())),
263- &path,
264- )
265- .unwrap();
261+ let zipped = zip ( EverythingIsStudentFilePolicy :: new ( path. clone ( ) ) , & path) . unwrap ( ) ;
266262 let mut archive = ZipArchive :: new ( Cursor :: new ( zipped) ) . unwrap ( ) ;
263+ assert ! ( archive. len( ) > 0 ) ;
267264 for i in 0 ..archive. len ( ) {
268265 log:: debug!( "{:?}" , archive. by_index( i) . unwrap( ) . name( ) ) ;
269266 }
@@ -332,5 +329,21 @@ mod test {
332329 . unwrap ( ) ;
333330 assert ! ( temp. path( ) . join( "src" ) . exists( ) ) ;
334331 }
335- */
332+
333+ #[ cfg( windows) ]
334+ #[ test]
335+ fn windows_paths_get_converted ( ) {
336+ let win_path = PathBuf :: from ( r"tests\data\dir" ) ;
337+ let zipped = zip (
338+ EverythingIsStudentFilePolicy :: new ( win_path. clone ( ) ) ,
339+ & win_path,
340+ )
341+ . unwrap ( ) ;
342+ let mut ziparch = ZipArchive :: new ( Cursor :: new ( zipped) ) . unwrap ( ) ;
343+ assert ! ( ziparch. len( ) > 0 ) ;
344+ for i in 0 ..ziparch. len ( ) {
345+ let file = ziparch. by_index ( i) . unwrap ( ) ;
346+ assert ! ( file. name( ) . chars( ) . find( |c| c == & '\\' ) . is_none( ) )
347+ }
348+ }
336349}
0 commit comments