rizin/test/db/cmd/regexp
Riccardo Schirone 187f314c49
Unwrap quoted strings when passing args to newer handlers ##newshell (#17732)
* Unwrap quoted strings when passing args to newer handlers ##newshell

When a user wraps an argument, it means like in SH that he wants the
command to consider the argument as one single arg, even if composed by
multiple words. The same applies for r2newshell. So far we did not
unwrap quoted strings to maintain compatibility with old shell, but
doing this unwrapping is one of the nice feature of newshell.

* Add tests for quoting/unquoting

* Adjust tests with `w` for newshell/oldshell
2020-09-30 14:25:38 +08:00

66 lines
No EOL
857 B
Text

NAME=/e /test/i
FILE=malloc://1024
CMDS=<<EOF
w test
w Test@444
?e
e search.in=block
b 777
/e /test/i
EOF
EXPECT=<<EOF
0x00000000 hit0_0 "test"
0x000001bc hit0_1 "Test"
EOF
RUN
NAME=/e m (invalid) #742
FILE=malloc://1024
CMDS=<<EOF
w test
w Test@444
/e m
/e m
/e m
/e m
EOF
EXPECT=<<EOF
EOF
RUN
NAME="/e /t\wst\d\d\d\s\w\w/i" - oldshell
ARGS=-ecfg.newshell=false
FILE=malloc://1024
CMDS=<<EOF
w "test123 ab"
w "Test123 ab" @444
?e
e search.in=block
b 777
"/e /t\wst\d\d\d\s\w\w/i"
EOF
EXPECT=<<EOF
0x00000001 hit0_0 ""test123 ab""
0x000001bd hit0_1 ""Test123 ab""
EOF
RUN
NAME="/e /t\wst\d\d\d\s\w\w/i" - newshell
ARGS=-ecfg.newshell=true
FILE=malloc://1024
CMDS=<<EOF
w '"test123 ab"'
w '"Test123 ab"' @444
?e
e search.in=block
b 777
"/e /t\wst\d\d\d\s\w\w/i"
EOF
EXPECT=<<EOF
0x00000001 hit0_0 ""test123 ab""
0x000001bd hit0_1 ""Test123 ab""
EOF
RUN