summaryrefslogtreecommitdiff
path: root/t/t9903-bash-prompt.sh
diff options
context:
space:
mode:
authorMartin Erik Werner <martinerikwerner@gmail.com>2013-02-13 20:58:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-02-13 21:56:01 (GMT)
commitdc7e7bced41b3a362a94cb1670ff183459d8d3a8 (patch)
treed98e1ade795ec7877f92b143121af5af8c2b3b8f /t/t9903-bash-prompt.sh
parent58978e822c5a6bacba19641626e1907139f5d99b (diff)
downloadgit-dc7e7bced41b3a362a94cb1670ff183459d8d3a8.zip
git-dc7e7bced41b3a362a94cb1670ff183459d8d3a8.tar.gz
git-dc7e7bced41b3a362a94cb1670ff183459d8d3a8.tar.bz2
t9903: add extra tests for bash.showDirtyState
Add 3 extra tests for the bash.showDirtyState config option; the tests now cover all combinations of the shell var being set/unset and the config option being missing/enabled/disabled, given a dirty file. Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9903-bash-prompt.sh')
-rwxr-xr-xt/t9903-bash-prompt.sh38
1 files changed, 37 insertions, 1 deletions
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index dd9ac6a..2101d91 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -360,12 +360,48 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '
test_cmp expected "$actual"
'
-test_expect_success 'prompt - dirty status indicator - disabled by config' '
+test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '
printf " (master)" > expected &&
echo "dirty" > file &&
test_when_finished "git reset --hard" &&
test_config bash.showDirtyState false &&
(
+ sane_unset GIT_PS1_SHOWDIRTYSTATE &&
+ __git_ps1 > "$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '
+ printf " (master)" > expected &&
+ echo "dirty" > file &&
+ test_when_finished "git reset --hard" &&
+ test_config bash.showDirtyState true &&
+ (
+ sane_unset GIT_PS1_SHOWDIRTYSTATE &&
+ __git_ps1 > "$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '
+ printf " (master)" > expected &&
+ echo "dirty" > file &&
+ test_when_finished "git reset --hard" &&
+ test_config bash.showDirtyState false &&
+ (
+ GIT_PS1_SHOWDIRTYSTATE=y &&
+ __git_ps1 > "$actual"
+ ) &&
+ test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '
+ printf " (master *)" > expected &&
+ echo "dirty" > file &&
+ test_when_finished "git reset --hard" &&
+ test_config bash.showDirtyState true &&
+ (
GIT_PS1_SHOWDIRTYSTATE=y &&
__git_ps1 > "$actual"
) &&