File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -414,3 +414,35 @@ fn etag(contents: &[u8]) -> String {
414414 ^ u64:: from_le_bytes ( sha256[ 8 ..16 ] . try_into ( ) . unwrap ( ) ) ;
415415 format ! ( "\" {hash:016x}\" " )
416416}
417+
418+ #[ cfg( test) ]
419+ mod test {
420+ use quote:: quote;
421+ use syn:: parse2;
422+
423+ use crate :: IgnoreDirsWithSpan ;
424+
425+ #[ test]
426+ fn handles_ident_ignoredirs ( ) {
427+ let res = parse2 :: < IgnoreDirsWithSpan > ( quote ! { [ big] } ) ;
428+ assert ! ( res. is_ok( ) ) ;
429+ }
430+
431+ #[ test]
432+ fn handles_litstr_ignoredirs ( ) {
433+ let res = parse2 :: < IgnoreDirsWithSpan > ( quote ! { [ "big" ] } ) ;
434+ assert ! ( res. is_ok( ) ) ;
435+ }
436+
437+ #[ test]
438+ fn errors_on_invalid_ignoredir ( ) {
439+ let res = parse2 :: < IgnoreDirsWithSpan > ( quote ! { [ 2 ] } ) ;
440+ assert ! ( res. is_err( ) ) ;
441+ }
442+
443+ #[ test]
444+ fn errors_on_ignoredirs_one_invalid ( ) {
445+ let res = parse2 :: < IgnoreDirsWithSpan > ( quote ! { [ big, 2 ] } ) ;
446+ assert ! ( res. is_err( ) ) ;
447+ }
448+ }
You can’t perform that action at this time.
0 commit comments