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() {
69
69
. stdout_only ( "\x1F 7\n " ) ;
70
70
}
71
71
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
+
72
87
#[ test]
73
88
fn escaped_unicode_four_digit ( ) {
74
89
new_ucmd ! ( ) . args ( & [ "\\ u0125" ] ) . succeeds ( ) . stdout_only ( "ĥ" ) ;
@@ -148,6 +163,21 @@ fn sub_b_string_handle_escapes() {
148
163
. stdout_only ( "hello \t world" ) ;
149
164
}
150
165
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
+
151
181
#[ test]
152
182
fn sub_b_string_validate_field_params ( ) {
153
183
new_ucmd ! ( )
You can’t perform that action at this time.
0 commit comments