[PATCH v2 06/11] t9903: move PS1 color code variable definitions to lib-bash.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Define a new 'set_ps1_format_vars' function in lib-bash.sh that sets
the c_red, c_green, c_lblue, and c_clear variables.  Call this
function from run_pcmode_tests().  This is a step toward moving the
shell prompt tests to a separate library file so that they can be
reused to test prompting in Zsh.

Signed-off-by: Richard Hansen <rhansen@xxxxxxx>
---
 t/lib-bash.sh          | 6 ++++++
 t/t9903-bash-prompt.sh | 5 +----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/t/lib-bash.sh b/t/lib-bash.sh
index a0f4e16..9d428bd 100644
--- a/t/lib-bash.sh
+++ b/t/lib-bash.sh
@@ -18,5 +18,11 @@ shellname=Bash
 
 ps1_expansion_enable () { shopt -s promptvars; }
 ps1_expansion_disable () { shopt -u promptvars; }
+set_ps1_format_vars () {
+	c_red='\\[\\e[31m\\]'
+	c_green='\\[\\e[32m\\]'
+	c_lblue='\\[\\e[1;34m\\]'
+	c_clear='\\[\\e[0m\\]'
+}
 
 . ./test-lib.sh
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 27135a1..fe60cf9 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -10,10 +10,7 @@ test_description='test git-specific bash prompt functions'
 . "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"
 
 actual="$TRASH_DIRECTORY/actual"
-c_red='\\[\\e[31m\\]'
-c_green='\\[\\e[32m\\]'
-c_lblue='\\[\\e[1;34m\\]'
-c_clear='\\[\\e[0m\\]'
+set_ps1_format_vars
 
 test_expect_success "setup for $shellname prompt tests" '
 	git init otherrepo &&
-- 
2.0.0

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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]