This series adds test cases for running __git_ps1 (see
contrib/completion/git-prompt.sh) from Zsh.

This series also adds more Bash test cases to test how __git_ps1
reacts to disabling Bash's PS1 parameter expansion.  (This is related
to adding Zsh test cases:  Zsh doesn't perform parameter expansion on
PS1 by default but many users turn it on, so the Zsh test script must
test __git_ps1 in both states.  Bash expands PS1 by default and users
rarely turn it off, but testing both states in Bash improves the
symmetry with the Zsh test cases.)

This is the approach I took:

  1. delete the last test case in t9903 ("prompt - zsh color pc mode")
  2. add two new functions to t/lib-bash.sh:
         ps1_expansion_enable () { shopt -s promptvars; }
         ps1_expansion_disable () { shopt -u promptvars; }
  3. loop over the relevant test cases twice:  once after calling
     ps1_expansion_enable and once after calling ps1_expansion_disable
     (with appropriate adjustments to the expected output)
  4. move the test cases in t9903 to a separate library file and
     source it from t9903-bash-prompt.sh
  5. create two new files:
       * t/lib-zsh.sh (same as t/lib-bash.sh but tweaked for zsh)
       * t/t9904-zsh-prompt.sh (same as t/t9903-bash-prompt.sh but
         tweaked for zsh)

There are a lot of indendation changes, so I recommend examining the
changes via diff -w.

Richard Hansen (10):
  t9903: remove Zsh test from the suite of Bash prompt tests
  t9903: put the Bash pc mode prompt test cases in a function
  t9903: move test name prefix to a separate variable
  t9903: run pc mode tests again with PS1 expansion disabled
  t9903: include "Bash" in test names via new $shellname var
  t9903: move PS1 color code variable definitions to lib-bash.sh
  t9903: move prompt tests to a new lib-prompt-tests.sh file
  lib-prompt-tests.sh: put all tests inside a function
  lib-prompt-tests.sh: add variable for string that encodes percent in
    PS1
  t9904: new __git_ps1 tests for Zsh

 t/lib-bash.sh          |  12 +
 t/lib-prompt-tests.sh  | 633 +++++++++++++++++++++++++++++++++++++++++++++++++
 t/lib-zsh.sh           |  30 +++
 t/t9903-bash-prompt.sh | 582 +--------------------------------------------
 t/t9904-zsh-prompt.sh  |  10 +
 5 files changed, 687 insertions(+), 580 deletions(-)
 create mode 100644 t/lib-prompt-tests.sh
 create mode 100644 t/lib-zsh.sh
 create mode 100755 t/t9904-zsh-prompt.sh

-- 
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