File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1195,3 +1195,31 @@ fn test_attributes_many() {
11951195 assert_eq ! ( & attrs. attrs( ) . collect:: <Vec <_>>( ) , test_attrs) ;
11961196 }
11971197}
1198+
1199+ #[ test]
1200+ // NOTE: Documenting the current panic message. Ideally this input should be silently ignored
1201+ #[ should_panic = "end byte index 3 is not a char boundary; it is inside '€' (bytes 1..4 of string)" ]
1202+ fn test_style_from_non_ascii_fg ( ) {
1203+ // len() == 7, starts_with('#'), but slices [1..3] land mid-€ (3 bytes)
1204+ let fg = "#€€" ;
1205+ assert_eq ! ( fg. len( ) , 7 ) ;
1206+
1207+ let parsed_style = Style :: from_dotted_str ( fg) ;
1208+
1209+ // silently ignores non-ascii
1210+ assert_eq ! ( parsed_style, Style :: default ( ) ) ;
1211+ }
1212+
1213+ #[ test]
1214+ // NOTE: Documenting the current panic message. Ideally this input should be silently ignored
1215+ #[ should_panic = "end byte index 6 is not a char boundary; it is inside '€' (bytes 4..7 of string)" ]
1216+ fn test_style_from_non_ascii_bg ( ) {
1217+ // len() == 10, starts_with("on_#"), but slices [4..6] land mid-€
1218+ let bg = "on_#€€" ;
1219+ assert_eq ! ( bg. len( ) , 10 ) ;
1220+
1221+ let parsed_style = Style :: from_dotted_str ( bg) ;
1222+
1223+ // silently ignores non-ascii
1224+ assert_eq ! ( parsed_style, Style :: default ( ) ) ;
1225+ }
You can’t perform that action at this time.
0 commit comments