aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-vars
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-17 16:46:57 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-17 16:46:57 +0200
commite32b6503e75d5bcbf8ffff69cafb09523ff2b482 (patch)
treed0d68a95f68d55215b86f792e11e89b1e75b1ed1 /shell/hush_test/hush-vars
parent203fd7bc66b869e5022ad33d26065e69eaaaf66b (diff)
downloadbusybox-e32b6503e75d5bcbf8ffff69cafb09523ff2b482.tar.gz
hush: support ${VAR:N:-M}
function old new delta expand_one_var 1602 1615 +13 builtin_type 114 116 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-vars')
-rw-r--r--shell/hush_test/hush-vars/var_bash1b.right23
-rwxr-xr-xshell/hush_test/hush-vars/var_bash1b.tests24
2 files changed, 47 insertions, 0 deletions
diff --git a/shell/hush_test/hush-vars/var_bash1b.right b/shell/hush_test/hush-vars/var_bash1b.right
new file mode 100644
index 000000000..fafc0f07c
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_bash1b.right
@@ -0,0 +1,23 @@
+all |0123456
+4: |456
+4:2 |45
+4:-1 |45
+4:-2 |4
+4:-3 |
+-4: |3456
+-4:2 |34
+-4:-1 |345
+-4:-2 |34
+-4:-3 |3
+-4:-4 |
+-4:i=2 |34
+-4:i=-2|34
+-4:i=-3|3
+-4:i=-4|
+-5: |23456
+-6: |123456
+-7: |0123456
+-8: |
+-9: |
+-9:-99 |
+Ok:0
diff --git a/shell/hush_test/hush-vars/var_bash1b.tests b/shell/hush_test/hush-vars/var_bash1b.tests
new file mode 100755
index 000000000..efbdef35c
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_bash1b.tests
@@ -0,0 +1,24 @@
+set -- 0123456
+ echo "all |"$1
+ echo "4: |"${1:4}
+ echo "4:2 |"${1:4:2}
+ echo "4:-1 |"${1:4:-1}
+ echo "4:-2 |"${1:4:-2}
+ echo "4:-3 |"${1:4:-3}
+ echo "-4: |"${1: -4}
+ echo "-4:2 |"${1: -4:2}
+ echo "-4:-1 |"${1: -4:-1}
+ echo "-4:-2 |"${1: -4:-2}
+ echo "-4:-3 |"${1: -4:-3}
+ echo "-4:-4 |"${1: -4:-4}
+i=2; echo "-4:i=2 |"${1: -4:i}
+i=-2; echo "-4:i=-2|"${1: -4:i}
+i=-3; echo "-4:i=-3|"${1: -4:i}
+i=-4; echo "-4:i=-4|"${1: -4:i}
+ echo "-5: |"${1: -5}
+ echo "-6: |"${1: -6}
+ echo "-7: |"${1: -7}
+ echo "-8: |"${1: -8}
+ echo "-9: |"${1: -9}
+ echo "-9:-99 |"${1: -9:-99}
+echo Ok:$?