@@ -2459,6 +2459,70 @@ mod gnu_cksum_c {
24592459 scene
24602460 }
24612461
2462+ fn make_scene_with_comment ( ) -> TestScenario {
2463+ let scene = make_scene ( ) ;
2464+
2465+ scene
2466+ . fixtures
2467+ . append ( "CHECKSUMS" , "# Very important comment\n " ) ;
2468+
2469+ scene
2470+ }
2471+
2472+ fn make_scene_with_invalid_line ( ) -> TestScenario {
2473+ let scene = make_scene_with_comment ( ) ;
2474+
2475+ scene. fixtures . append ( "CHECKSUMS" , "invalid_line\n " ) ;
2476+
2477+ scene
2478+ }
2479+
2480+ #[ test]
2481+ fn test_tagged_invalid_length ( ) {
2482+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
2483+
2484+ at. write (
2485+ "sha2-bad-length.sum" ,
2486+ "SHA2-128 (/dev/null) = 38b060a751ac96384cd9327eb1b1e36a" ,
2487+ ) ;
2488+
2489+ ucmd. arg ( "--check" )
2490+ . arg ( "sha2-bad-length.sum" )
2491+ . fails ( )
2492+ . stderr_contains ( "sha2-bad-length.sum: no properly formatted checksum lines found" ) ;
2493+ }
2494+
2495+ #[ test]
2496+ fn test_untagged_base64_matching_tag ( ) {
2497+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
2498+
2499+ at. write ( "tag-prefix.sum" , "SHA1+++++++++++++++++++++++= /dev/null" ) ;
2500+
2501+ ucmd. arg ( "--check" )
2502+ . arg ( "-a" )
2503+ . arg ( "sha1" )
2504+ . arg ( "tag-prefix.sum" )
2505+ . fails ( )
2506+ . stderr_contains ( "WARNING: 1 computed checksum did NOT match" ) ;
2507+ }
2508+
2509+ #[ test]
2510+ #[ cfg_attr( windows, ignore = "Akward filename is not supported on windows" ) ]
2511+ fn test_akward_filename ( ) {
2512+ let ts = TestScenario :: new ( util_name ! ( ) ) ;
2513+ let at = & ts. fixtures ;
2514+
2515+ let akward_file = "abc (f) = abc" ;
2516+
2517+ at. touch ( akward_file) ;
2518+
2519+ let result = ts. ucmd ( ) . arg ( "-a" ) . arg ( "sha1" ) . arg ( akward_file) . succeeds ( ) ;
2520+
2521+ at. write_bytes ( "tag-akward.sum" , result. stdout ( ) ) ;
2522+
2523+ ts. ucmd ( ) . arg ( "-c" ) . arg ( "tag-akward.sum" ) . succeeds ( ) ;
2524+ }
2525+
24622526 #[ test]
24632527 #[ ignore = "todo" ]
24642528 fn test_signed_checksums ( ) {
@@ -2510,16 +2574,6 @@ mod gnu_cksum_c {
25102574 . no_output ( ) ;
25112575 }
25122576
2513- fn make_scene_with_comment ( ) -> TestScenario {
2514- let scene = make_scene ( ) ;
2515-
2516- scene
2517- . fixtures
2518- . append ( "CHECKSUMS" , "# Very important comment\n " ) ;
2519-
2520- scene
2521- }
2522-
25232577 #[ test]
25242578 fn test_status_with_comment ( ) {
25252579 let scene = make_scene_with_comment ( ) ;
@@ -2533,14 +2587,6 @@ mod gnu_cksum_c {
25332587 . no_output ( ) ;
25342588 }
25352589
2536- fn make_scene_with_invalid_line ( ) -> TestScenario {
2537- let scene = make_scene_with_comment ( ) ;
2538-
2539- scene. fixtures . append ( "CHECKSUMS" , "invalid_line\n " ) ;
2540-
2541- scene
2542- }
2543-
25442590 #[ test]
25452591 fn test_check_strict ( ) {
25462592 let scene = make_scene_with_invalid_line ( ) ;
0 commit comments