about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-02-10 20:29:49 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-02-10 20:29:49 +0000
commit51a646917a09f93f88ded76244780a09fae5acb0 (patch)
tree8c388cec82f57692020dc8dfc8b38cab5fb918f0 /Test
parent7b31a15de84ca575541863394f8cca4e09af78c2 (diff)
downloadzsh-51a646917a09f93f88ded76244780a09fae5acb0.tar.gz
zsh-51a646917a09f93f88ded76244780a09fae5acb0.tar.xz
zsh-51a646917a09f93f88ded76244780a09fae5acb0.zip
26545: new "emulate" test
Diffstat (limited to 'Test')
-rw-r--r--Test/B07emulate.ztst74
1 files changed, 74 insertions, 0 deletions
diff --git a/Test/B07emulate.ztst b/Test/B07emulate.ztst
new file mode 100644
index 000000000..57eea3806
--- /dev/null
+++ b/Test/B07emulate.ztst
@@ -0,0 +1,74 @@
+# Test the "emulate" builtin and related functions.
+
+%prep
+
+  isset() { 
+    if [[ -o $1 ]]; then print yes; else print no; fi
+  }
+  showopts() {
+      # Set for Bourne shell emulation
+      isset shwordsplit
+      # Set in native mode and unless "emulate -R" is in use
+      isset banghist
+  }
+
+%test
+
+  (showopts
+  fn() {
+     emulate sh
+  }
+  fn
+  showopts)
+0:Basic use of emulate
+>no
+>yes
+>yes
+>yes
+
+  fn() {
+    emulate -L sh
+    showopts
+  }
+  showopts
+  fn
+  showopts
+0:Use of emulate -L
+>no
+>yes
+>yes
+>yes
+>no
+>yes
+
+  (showopts
+  emulate -R sh
+  showopts)
+0:Use of emulate -R
+>no
+>yes
+>yes
+>no
+
+  showopts
+  emulate sh -c 'showopts'
+  showopts
+0:Use of emulate -c
+>no
+>yes
+>yes
+>yes
+>no
+>yes
+
+
+  showopts
+  emulate -R sh -c 'showopts'
+  showopts
+0:Use of emulate -R -c
+>no
+>yes
+>yes
+>no
+>no
+>yes