diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-07-26 15:29:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-07-26 15:32:46 +0200 |
commit | b278d82c61ab5125b5c7e350b264c1f3d52d682b (patch) | |
tree | f2c0a2c2bd630b22f7eebee1d63eb810e480b4e5 /shell/hush_test | |
parent | 05c5d745f7b14e265144489b7809a3d6dbbadec6 (diff) | |
download | busybox-w32-b278d82c61ab5125b5c7e350b264c1f3d52d682b.tar.gz busybox-w32-b278d82c61ab5125b5c7e350b264c1f3d52d682b.tar.bz2 busybox-w32-b278d82c61ab5125b5c7e350b264c1f3d52d682b.zip |
hush: implement $'str' bashism
function old new delta
parse_dollar_squote - 441 +441
encode_then_expand_vararg 359 380 +21
parse_stream 2252 2271 +19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 481/0) Total: 481 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test')
6 files changed, 36 insertions, 0 deletions
diff --git a/shell/hush_test/hush-quoting/dollar_squote_bash1.right b/shell/hush_test/hush-quoting/dollar_squote_bash1.right new file mode 100644 index 000000000..9f4e25efa --- /dev/null +++ b/shell/hush_test/hush-quoting/dollar_squote_bash1.right | |||
@@ -0,0 +1,10 @@ | |||
1 | a b | ||
2 | $'a\tb' | ||
3 | a | ||
4 | b c | ||
5 | def | ||
6 | a'b c"d e\f | ||
7 | a3b c3b e33f | ||
8 | a\80b c08b | ||
9 | a3b c30b | ||
10 | x y | ||
diff --git a/shell/hush_test/hush-quoting/dollar_squote_bash1.tests b/shell/hush_test/hush-quoting/dollar_squote_bash1.tests new file mode 100755 index 000000000..6fc411b93 --- /dev/null +++ b/shell/hush_test/hush-quoting/dollar_squote_bash1.tests | |||
@@ -0,0 +1,8 @@ | |||
1 | echo $'a\tb' | ||
2 | echo "$'a\tb'" | ||
3 | echo $'a\nb' $'c\nd''ef' | ||
4 | echo $'a\'b' $'c\"d' $'e\\f' | ||
5 | echo $'a\63b' $'c\063b' $'e\0633f' | ||
6 | echo $'a\80b' $'c\608b' | ||
7 | echo $'a\x33b' $'c\x330b' | ||
8 | echo $'x\x9y' | ||
diff --git a/shell/hush_test/hush-quoting/dollar_squote_bash2.right b/shell/hush_test/hush-quoting/dollar_squote_bash2.right new file mode 100644 index 000000000..f7a1731dd --- /dev/null +++ b/shell/hush_test/hush-quoting/dollar_squote_bash2.right | |||
@@ -0,0 +1,6 @@ | |||
1 | strstrstrstrstrstrstrstrstrstrstrstrstrstrstrstrstr | ||
2 | strstrstrstrstrstrstrstrstrstrstrstrstrstrstrstrstr | ||
3 | 80:\ | ||
4 | 81:\ | ||
5 | 82:\ | ||
6 | Done:0 | ||
diff --git a/shell/hush_test/hush-quoting/dollar_squote_bash2.tests b/shell/hush_test/hush-quoting/dollar_squote_bash2.tests new file mode 100755 index 000000000..449772813 --- /dev/null +++ b/shell/hush_test/hush-quoting/dollar_squote_bash2.tests | |||
@@ -0,0 +1,10 @@ | |||
1 | # Embedded NULs | ||
2 | echo $'str\x00'strstrstrstrstrstrstrstrstrstrstrstrstrstrstrstr | ||
3 | echo $'str\000'strstrstrstrstrstrstrstrstrstrstrstrstrstrstrstr | ||
4 | |||
5 | # The chars after '\' are hex 0x80,81,82... | ||
6 | echo 80:$'\' | ||
7 | echo 81:$'\' | ||
8 | echo 82:$'\' | ||
9 | |||
10 | echo Done:$? | ||
diff --git a/shell/hush_test/hush-vars/var_bash7.right b/shell/hush_test/hush-vars/var_bash7.right new file mode 100644 index 000000000..223b7836f --- /dev/null +++ b/shell/hush_test/hush-vars/var_bash7.right | |||
@@ -0,0 +1 @@ | |||
B | |||
diff --git a/shell/hush_test/hush-vars/var_bash7.tests b/shell/hush_test/hush-vars/var_bash7.tests new file mode 100755 index 000000000..c4ce03f7f --- /dev/null +++ b/shell/hush_test/hush-vars/var_bash7.tests | |||
@@ -0,0 +1 @@ | |||
x=AB; echo "${x#$'\x41'}" | |||