diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2025-08-11 17:31:36 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2025-08-11 17:36:02 +0200 |
| commit | 0da6c813e13eaf1cddfd7cbee1f3a5a4ffe58ec0 (patch) | |
| tree | 6ddac5fd794c5b2811f6b638d2044fe1b4e09fb1 /shell/ash_test | |
| parent | d18c9eadf0f3fa5a7ca67e360c43aaf2e7d12f1c (diff) | |
| download | busybox-w32-0da6c813e13eaf1cddfd7cbee1f3a5a4ffe58ec0.tar.gz busybox-w32-0da6c813e13eaf1cddfd7cbee1f3a5a4ffe58ec0.tar.bz2 busybox-w32-0da6c813e13eaf1cddfd7cbee1f3a5a4ffe58ec0.zip | |
hush: fix var_backslash1.tests
function old new delta
o_addqblock - 131 +131
append_str_maybe_ifs_split 53 100 +47
expand_one_var 1872 1897 +25
encode_then_expand_vararg 380 399 +19
sig_unblock 41 43 +2
sig_block 41 40 -1
sigprocmask_allsigs 33 31 -2
expand_vars_to_list 1080 1077 -3
wait_for_child_or_signal 202 193 -9
o_addQstr 175 42 -133
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/5 up/down: 224/-148) Total: 76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
| -rw-r--r-- | shell/ash_test/ash-vars/var_backslash1.right | 9 | ||||
| -rwxr-xr-x | shell/ash_test/ash-vars/var_backslash1.tests | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/var_backslash1.right b/shell/ash_test/ash-vars/var_backslash1.right index f384da1f5..3f2c21289 100644 --- a/shell/ash_test/ash-vars/var_backslash1.right +++ b/shell/ash_test/ash-vars/var_backslash1.right | |||
| @@ -14,6 +14,15 @@ ${a##\\"$c"} removes \*: |bc| - matches \, then * | |||
| 14 | ${a##$b} removes \: |*bc| - matches \ | 14 | ${a##$b} removes \: |*bc| - matches \ |
| 15 | ${a##"$b"} removes \: |*bc| - matches \ | 15 | ${a##"$b"} removes \: |*bc| - matches \ |
| 16 | 16 | ||
| 17 | Single quote tests: | ||
| 18 | ${a##?'*'} removes \*: |bc| - matches one char, then * | ||
| 19 | ${a##'\'*} removes everything: || - matches \, then all | ||
| 20 | ${a##'\'\*} removes \*: |bc| - matches \, then * | ||
| 21 | ${a##'\*'} removes \*: |bc| - matches \, then * | ||
| 22 | ${a##'\'$c} removes everything: || - matches \, then all | ||
| 23 | ${a##'\'\$c} removes nothing: |\*bc| - matches \, but then second char is not $ | ||
| 24 | ${a##'\'"$c"} removes \*: |bc| - matches \, then * | ||
| 25 | |||
| 17 | ${a##"$b"?} removes \*: |bc| - matches \, then one char | 26 | ${a##"$b"?} removes \*: |bc| - matches \, then one char |
| 18 | ${a##"$b"*} removes everything: || - matches \, then all | 27 | ${a##"$b"*} removes everything: || - matches \, then all |
| 19 | ${a##"$b""?"} removes nothing: |\*bc| - second char is not ? | 28 | ${a##"$b""?"} removes nothing: |\*bc| - second char is not ? |
diff --git a/shell/ash_test/ash-vars/var_backslash1.tests b/shell/ash_test/ash-vars/var_backslash1.tests index 7eea3cc19..015a6107b 100755 --- a/shell/ash_test/ash-vars/var_backslash1.tests +++ b/shell/ash_test/ash-vars/var_backslash1.tests | |||
| @@ -17,6 +17,16 @@ echo '${a##\\"$c"} removes \*: '"|${a##\\"$c"}|"' - matches \, then *' | |||
| 17 | echo '${a##$b} removes \: '"|${a##$b}|"' - matches \' | 17 | echo '${a##$b} removes \: '"|${a##$b}|"' - matches \' |
| 18 | echo '${a##"$b"} removes \: '"|${a##"$b"}|"' - matches \' | 18 | echo '${a##"$b"} removes \: '"|${a##"$b"}|"' - matches \' |
| 19 | echo | 19 | echo |
| 20 | sq="'" | ||
| 21 | echo 'Single quote tests:' | ||
| 22 | echo '${a##?'$sq'*'$sq'} removes \*: '"|${a##?'*'}|"' - matches one char, then *' | ||
| 23 | echo '${a##'$sq'\'$sq'*} removes everything: '"|${a##'\'*}|"' - matches \, then all' | ||
| 24 | echo '${a##'$sq'\'$sq'\*} removes \*: '"|${a##'\'\*}|"' - matches \, then *' | ||
| 25 | echo '${a##'$sq'\*'$sq'} removes \*: '"|${a##'\*'}|"' - matches \, then *' | ||
| 26 | echo '${a##'$sq'\'$sq'$c} removes everything: '"|${a##'\'$c}|"' - matches \, then all' | ||
| 27 | echo '${a##'$sq'\'$sq'\$c} removes nothing: '"|${a##'\'\$c}|"' - matches \, but then second char is not $' | ||
| 28 | echo '${a##'$sq'\'$sq'"$c"} removes \*: '"|${a##'\'"$c"}|"' - matches \, then *' | ||
| 29 | echo | ||
| 20 | ## In bash, this isn't working as expected | 30 | ## In bash, this isn't working as expected |
| 21 | #echo '${a##$b?} removes \*: '"|${a##$b?}|"' - matches \, then one char' # bash prints |\*bc| | 31 | #echo '${a##$b?} removes \*: '"|${a##$b?}|"' - matches \, then one char' # bash prints |\*bc| |
| 22 | #echo '${a##$b*} removes everything: '"|${a##$b*}|"' - matches \, then all' # bash prints |\*bc| | 32 | #echo '${a##$b*} removes everything: '"|${a##$b*}|"' - matches \, then all' # bash prints |\*bc| |
