about summary refs log tree commit diff
path: root/Test/D04parameter.ztst
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-11-18 10:07:55 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-11-18 10:07:55 +0000
commit23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95 (patch)
tree80d7f0e6c868a1283f3275cf88e08b8c86d509c1 /Test/D04parameter.ztst
parent851b8e151004ec729dad9c8c7867bbf67649df8e (diff)
downloadzsh-23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95.tar.gz
zsh-23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95.tar.xz
zsh-23bdfc7fd2a012d5205ed22d18eb39e41c8fbc95.zip
28418: add ${NAME:OFFSET:LENGTH} substitution
Diffstat (limited to 'Test/D04parameter.ztst')
-rw-r--r--Test/D04parameter.ztst46
1 files changed, 46 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index fe978263f..7c6a465af 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1256,3 +1256,49 @@
 0:$ZSH_EVAL_CONTEXT and $zsh_eval_context
 >toplevel
 >shfunc cmdsubst
+
+   foo="123456789"
+   print ${foo:3}
+   print ${foo: 1 + 3}
+   print ${foo:$(( 2 + 3))}
+   print ${foo:$(echo 3 + 3)}
+   print ${foo:3:1}
+   print ${foo: 1 + 3:(4-2)/2}
+   print ${foo:$(( 2 + 3)):$(( 7 - 6 ))}
+   print ${foo:$(echo 3 + 3):`echo 4 - 3`}
+   print ${foo: -1}
+   print ${foo: -10}
+0:Bash-style subscripts, scalar
+>3456789
+>456789
+>56789
+>6789
+>3
+>4
+>5
+>6
+>9
+>123456789
+
+   foo=(1 2 3 4 5 6 7 8 9)
+   print ${foo:3}
+   print ${foo: 1 + 3}
+   print ${foo:$(( 2 + 3))}
+   print ${foo:$(echo 3 + 3)}
+   print ${foo:3:1}
+   print ${foo: 1 + 3:(4-2)/2}
+   print ${foo:$(( 2 + 3)):$(( 7 - 6 ))}
+   print ${foo:$(echo 3 + 3):`echo 4 - 3`}
+   print ${foo: -1}
+   print ${foo: -10}
+0:Bash-style subscripts, array
+>3 4 5 6 7 8 9
+>4 5 6 7 8 9
+>5 6 7 8 9
+>6 7 8 9
+>3
+>4
+>5
+>6
+>9
+>1 2 3 4 5 6 7 8 9