about summary refs log tree commit diff
path: root/Test/D04parameter.ztst
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2011-05-19 16:24:38 +0000
committerMikael Magnusson <mikachu@gmail.com>2011-05-19 16:24:38 +0000
commit0198b8423dfd4aab7f1c1d2b2938cb5124724212 (patch)
tree7192fd28c81769078337a109f078647e3b8513b0 /Test/D04parameter.ztst
parent6a29bc80d032ec7224240789deb622e07478028c (diff)
downloadzsh-0198b8423dfd4aab7f1c1d2b2938cb5124724212.tar.gz
zsh-0198b8423dfd4aab7f1c1d2b2938cb5124724212.tar.xz
zsh-0198b8423dfd4aab7f1c1d2b2938cb5124724212.zip
29224: Support negative LEN in ${VAR:OFFSET:LEN} like bash.
Diffstat (limited to 'Test/D04parameter.ztst')
-rw-r--r--Test/D04parameter.ztst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 84b9c1a9f..6379c8cd0 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1366,6 +1366,7 @@
    print ${foo:$(echo 3 + 3):`echo 4 - 3`}
    print ${foo: -1}
    print ${foo: -10}
+   print ${foo:5:-2}
 0:Bash-style offsets, scalar
 >456789
 >56789
@@ -1377,6 +1378,7 @@
 >7
 >9
 >123456789
+>67
 
    foo=(1 2 3 4 5 6 7 8 9)
    print ${foo:3}
@@ -1389,6 +1391,7 @@
    print ${foo:$(echo 3 + 3):`echo 4 - 3`}
    print ${foo: -1}
    print ${foo: -10}
+   print ${foo:5:-2}
 0:Bash-style offsets, array
 >4 5 6 7 8 9
 >5 6 7 8 9
@@ -1400,6 +1403,7 @@
 >7
 >9
 >1 2 3 4 5 6 7 8 9
+>6 7
 
    testfn() {
      emulate -L sh
@@ -1438,3 +1442,13 @@
    print ${str:0:}
 1:Regression test for missing length after offset
 ?(eval):2: unrecognized modifier
+
+   foo="123456789"
+   print ${foo:5:-6}
+1:Regression test for total length < 0 in string
+?(eval):2: substring expression: 3 < 5
+
+   foo=(1 2 3 4 5 6 7 8 9)
+   print ${foo:5:-6}
+1:Regression test for total length < 0 in array
+?(eval):2: substring expression: 3 < 5