about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
Diffstat (limited to 'Test')
-rw-r--r--Test/.distfiles1
-rw-r--r--Test/B08shift.ztst33
2 files changed, 34 insertions, 0 deletions
diff --git a/Test/.distfiles b/Test/.distfiles
index 1c0102818..5826e7574 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -15,6 +15,7 @@ B04read.ztst
 B05eval.ztst
 B06fc.ztst
 B07emulate.ztst
+B08shift.ztst
 C01arith.ztst
 C02cond.ztst
 C03traps.ztst
diff --git a/Test/B08shift.ztst b/Test/B08shift.ztst
index e69de29bb..0aa922673 100644
--- a/Test/B08shift.ztst
+++ b/Test/B08shift.ztst
@@ -0,0 +1,33 @@
+# Test the shift builtin.
+
+%test
+
+  set -- one two three four five six seven eight nine ten
+  shift
+  print $*
+  shift 2
+  print $*
+  shift -p 3
+  print $*
+  shift -p
+  print $*
+0:shifting positional parameters
+>two three four five six seven eight nine ten
+>four five six seven eight nine ten
+>four five six seven
+>four five six
+
+  array=(yan tan tether mether pip azer sezar akker conter dick)
+  shift 2 array
+  print $array
+  shift array
+  print $array
+  shift -p 3 array
+  print $array
+  shift -p array
+  print $array
+0:shifting array
+>tether mether pip azer sezar akker conter dick
+>mether pip azer sezar akker conter dick
+>mether pip azer sezar
+>mether pip azer