These are the same tests as in t9903, but run in zsh instead of bash.

Signed-off-by: Richard Hansen <rhan...@bbn.com>
---
 t/lib-zsh.sh          | 30 ++++++++++++++++++++++++++++++
 t/t9904-zsh-prompt.sh | 10 ++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 t/lib-zsh.sh
 create mode 100755 t/t9904-zsh-prompt.sh

diff --git a/t/lib-zsh.sh b/t/lib-zsh.sh
new file mode 100644
index 0000000..fa6fcd9
--- /dev/null
+++ b/t/lib-zsh.sh
@@ -0,0 +1,30 @@
+# Shell library sourced instead of ./test-lib.sh by tests that need to
+# run under Zsh; primarily intended for tests of the git-prompt.sh
+# script.
+
+if test -n "$ZSH_VERSION" && test -z "$POSIXLY_CORRECT"; then
+       true
+elif command -v zsh >/dev/null 2>&1; then
+       unset POSIXLY_CORRECT
+       exec zsh "$0" "$@"
+else
+       echo '1..0 #SKIP skipping Zsh-specific tests; zsh not available'
+       exit 0
+fi
+
+# ensure that we are in full-on Zsh mode
+emulate -R zsh || exit 1
+
+shellname=Zsh
+
+ps1_expansion_enable () { setopt PROMPT_SUBST; }
+ps1_expansion_disable () { unsetopt PROMPT_SUBST; }
+set_ps1_format_vars () {
+       percent='%%%%'
+       c_red='%%F{red}'
+       c_green='%%F{green}'
+       c_lblue='%%F{blue}'
+       c_clear='%%f'
+}
+
+emulate sh -c '. ./test-lib.sh'
diff --git a/t/t9904-zsh-prompt.sh b/t/t9904-zsh-prompt.sh
new file mode 100755
index 0000000..a38a3fd
--- /dev/null
+++ b/t/t9904-zsh-prompt.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+test_description='test git-specific Zsh prompt functions'
+
+. ./lib-zsh.sh
+. "$TEST_DIRECTORY"/lib-prompt-tests.sh
+
+run_prompt_tests
+
+test_done
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to