File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,21 @@ fn escaped_octal_and_newline() {
6969 . stdout_only ( "\x1F 7\n " ) ;
7070}
7171
72+ #[ test]
73+ fn variable_sized_octal ( ) {
74+ for x in [ "|\\ 5|" , "|\\ 05|" , "|\\ 005|" ] {
75+ new_ucmd ! ( )
76+ . arg ( x)
77+ . succeeds ( )
78+ . stdout_only_bytes ( [ b'|' , 5u8 , b'|' ] ) ;
79+ }
80+
81+ new_ucmd ! ( )
82+ . arg ( "|\\ 0005|" )
83+ . succeeds ( )
84+ . stdout_only_bytes ( [ b'|' , 0 , b'5' , b'|' ] ) ;
85+ }
86+
7287#[ test]
7388fn escaped_unicode_four_digit ( ) {
7489 new_ucmd ! ( ) . args ( & [ "\\ u0125" ] ) . succeeds ( ) . stdout_only ( "ĥ" ) ;
@@ -148,6 +163,21 @@ fn sub_b_string_handle_escapes() {
148163 . stdout_only ( "hello \t world" ) ;
149164}
150165
166+ #[ test]
167+ fn sub_b_string_variable_size_unicode ( ) {
168+ for x in [ "\\ 5|" , "\\ 05|" , "\\ 005|" , "\\ 0005|" ] {
169+ new_ucmd ! ( )
170+ . args ( & [ "|%b" , x] )
171+ . succeeds ( )
172+ . stdout_only_bytes ( [ b'|' , 5u8 , b'|' ] ) ;
173+ }
174+
175+ new_ucmd ! ( )
176+ . args ( & [ "|%b" , "\\ 00005|" ] )
177+ . succeeds ( )
178+ . stdout_only_bytes ( [ b'|' , 0 , b'5' , b'|' ] ) ;
179+ }
180+
151181#[ test]
152182fn sub_b_string_validate_field_params ( ) {
153183 new_ucmd ! ( )
You can’t perform that action at this time.
0 commit comments