File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 33// For the full copyright and license information, please view the LICENSE
44// file that was distributed with this source code.
55
6+ use rstest:: rstest;
7+
68use uutests:: new_ucmd;
79use uutests:: util:: TestScenario ;
810use uutests:: util_name;
@@ -250,21 +252,30 @@ fn test_invalid_b2sum_length_option_not_multiple_of_8() {
250252 . ccmd ( "b2sum" )
251253 . arg ( "--length=9" )
252254 . arg ( at. subdir . join ( "testf" ) )
253- . fails_with_code ( 1 ) ;
255+ . fails_with_code ( 1 )
256+ . stderr_contains ( "b2sum: invalid length: '9'" )
257+ . stderr_contains ( "b2sum: length is not a multiple of 8" ) ;
254258}
255259
256- #[ test]
257- fn test_invalid_b2sum_length_option_too_large ( ) {
260+ #[ rstest]
261+ #[ case( "513" ) ]
262+ #[ case( "1024" ) ]
263+ #[ case( "18446744073709552000" ) ]
264+ fn test_invalid_b2sum_length_option_too_large ( #[ case] len : & str ) {
258265 let scene = TestScenario :: new ( util_name ! ( ) ) ;
259266 let at = & scene. fixtures ;
260267
261268 at. write ( "testf" , "foobar\n " ) ;
262269
263270 scene
264271 . ccmd ( "b2sum" )
265- . arg ( "--length=513" )
272+ . arg ( "--length" )
273+ . arg ( len)
266274 . arg ( at. subdir . join ( "testf" ) )
267- . fails_with_code ( 1 ) ;
275+ . fails_with_code ( 1 )
276+ . no_stdout ( )
277+ . stderr_contains ( format ! ( "b2sum: invalid length: '{len}'" ) )
278+ . stderr_contains ( "b2sum: maximum digest length for 'BLAKE2b' is 512 bits" ) ;
268279}
269280
270281#[ test]
You can’t perform that action at this time.
0 commit comments