@@ -220,6 +220,7 @@ fn test_escape_default() {
220220 }
221221 assert_eq ! ( string( '\n' ) , "\\ n" ) ;
222222 assert_eq ! ( string( '\r' ) , "\\ r" ) ;
223+ assert_eq ! ( string( '\t' ) , "\\ t" ) ;
223224 assert_eq ! ( string( '\'' ) , "\\ '" ) ;
224225 assert_eq ! ( string( '"' ) , "\\ \" " ) ;
225226 assert_eq ! ( string( ' ' ) , " " ) ;
@@ -417,3 +418,45 @@ fn eu_iterator_specializations() {
417418 check ( '\u{12340}' ) ;
418419 check ( '\u{10FFFF}' ) ;
419420}
421+
422+ #[ test]
423+ #[ should_panic]
424+ fn test_from_digit_radix_too_high ( ) {
425+ let _ = char:: from_digit ( 0 , 37 ) ;
426+ }
427+
428+ #[ test]
429+ fn test_from_digit_invalid_radix ( ) {
430+ assert ! ( char :: from_digit( 10 , 9 ) . is_none( ) ) ;
431+ }
432+
433+ #[ test]
434+ #[ should_panic]
435+ fn test_to_digit_radix_too_low ( ) {
436+ let _ = 'a' . to_digit ( 1 ) ;
437+ }
438+
439+ #[ test]
440+ #[ should_panic]
441+ fn test_to_digit_radix_too_high ( ) {
442+ let _ = 'a' . to_digit ( 37 ) ;
443+ }
444+
445+ #[ test]
446+ fn test_as_ascii_invalid ( ) {
447+ assert ! ( '❤' . as_ascii( ) . is_none( ) ) ;
448+ }
449+
450+ #[ test]
451+ #[ should_panic]
452+ fn test_encode_utf8_raw_buffer_too_small ( ) {
453+ let mut buf = [ 0u8 ; 1 ] ;
454+ let _ = char:: encode_utf8_raw ( 'ß' . into ( ) , & mut buf) ;
455+ }
456+
457+ #[ test]
458+ #[ should_panic]
459+ fn test_encode_utf16_raw_buffer_too_small ( ) {
460+ let mut buf = [ 0u16 ; 1 ] ;
461+ let _ = char:: encode_utf16_raw ( '𐐷' . into ( ) , & mut buf) ;
462+ }
0 commit comments