zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: emulate test
@ 2009-02-10 20:17 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2009-02-10 20:17 UTC (permalink / raw)
  To: Zsh hackers list

I'm just about to look at sticky emulation; before I do here are some
tests for the existing code.

Index: Test/B07emulate.ztst
===================================================================
RCS file: Test/B07emulate.ztst
diff -N Test/B07emulate.ztst
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Test/B07emulate.ztst	10 Feb 2009 20:15:58 -0000
@@ -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


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-10 20:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-10 20:17 PATCH: emulate test Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).