@@ -329,69 +329,68 @@ mod tests {
329329 }
330330
331331 #[ test]
332- #[ should_panic]
332+ #[ should_panic = "BencodeParseError(InvalidByte { pos: 0 }" ]
333333 fn negative_decode_bytes_neg_len ( ) {
334334 BencodeRef :: decode ( BYTES_NEG_LEN , BDecodeOpt :: default ( ) ) . unwrap ( ) ;
335335 }
336336
337337 #[ test]
338- #[ should_panic]
338+ #[ should_panic = "BencodeParseError(BytesEmpty { pos: 20 }" ]
339339 fn negative_decode_bytes_extra ( ) {
340340 BencodeRef :: decode ( BYTES_EXTRA , BDecodeOpt :: default ( ) ) . unwrap ( ) ;
341341 }
342342
343343 #[ test]
344- #[ should_panic]
345344 fn negative_decode_bytes_not_utf8 ( ) {
346345 let bencode = BencodeRef :: decode ( BYTES_NOT_UTF8 , BDecodeOpt :: default ( ) ) . unwrap ( ) ;
347346
348- bencode. str ( ) . unwrap ( ) ;
347+ assert ! ( bencode. str ( ) . is_none ( ) ) ;
349348 }
350349
351350 #[ test]
352- #[ should_panic]
351+ #[ should_panic = "BencodeParseError(InvalidIntParseError { pos: 1 }" ]
353352 fn negative_decode_int_nan ( ) {
354353 super :: decode_int ( INT_NAN , 1 , crate :: BEN_END ) . unwrap ( ) ;
355354 }
356355
357356 #[ test]
358- #[ should_panic]
357+ #[ should_panic = "BencodeParseError(InvalidIntZeroPadding { pos: 1 }" ]
359358 fn negative_decode_int_leading_zero ( ) {
360359 super :: decode_int ( INT_LEADING_ZERO , 1 , crate :: BEN_END ) . unwrap ( ) ;
361360 }
362361
363362 #[ test]
364- #[ should_panic]
363+ #[ should_panic = "BencodeParseError(InvalidIntZeroPadding { pos: 1 }" ]
365364 fn negative_decode_int_double_zero ( ) {
366365 super :: decode_int ( INT_DOUBLE_ZERO , 1 , crate :: BEN_END ) . unwrap ( ) ;
367366 }
368367
369368 #[ test]
370- #[ should_panic]
369+ #[ should_panic = "BencodeParseError(InvalidIntNegativeZero { pos: 1 }" ]
371370 fn negative_decode_int_negative_zero ( ) {
372371 super :: decode_int ( INT_NEGATIVE_ZERO , 1 , crate :: BEN_END ) . unwrap ( ) ;
373372 }
374373
375374 #[ test]
376- #[ should_panic]
375+ #[ should_panic = " BencodeParseError(InvalidIntParseError { pos: 1 }" ]
377376 fn negative_decode_int_double_negative ( ) {
378377 super :: decode_int ( INT_DOUBLE_NEGATIVE , 1 , crate :: BEN_END ) . unwrap ( ) ;
379378 }
380379
381380 #[ test]
382- #[ should_panic]
381+ #[ should_panic = "BencodeParseError(InvalidKeyOrdering { pos: 15, key: [97, 95, 107, 101, 121] }" ]
383382 fn negative_decode_dict_unordered_keys ( ) {
384383 BencodeRef :: decode ( DICT_UNORDERED_KEYS , BDecodeOpt :: new ( 5 , true , true ) ) . unwrap ( ) ;
385384 }
386385
387386 #[ test]
388- #[ should_panic]
387+ #[ should_panic = "BencodeParseError(InvalidKeyDuplicates { pos: 18, key: [97, 95, 107, 101, 121] }" ]
389388 fn negative_decode_dict_dup_keys_same_data ( ) {
390389 BencodeRef :: decode ( DICT_DUP_KEYS_SAME_DATA , BDecodeOpt :: default ( ) ) . unwrap ( ) ;
391390 }
392391
393392 #[ test]
394- #[ should_panic]
393+ #[ should_panic = "BencodeParseError(InvalidKeyDuplicates { pos: 18, key: [97, 95, 107, 101, 121] }" ]
395394 fn negative_decode_dict_dup_keys_diff_data ( ) {
396395 BencodeRef :: decode ( DICT_DUP_KEYS_DIFF_DATA , BDecodeOpt :: default ( ) ) . unwrap ( ) ;
397396 }
0 commit comments