From: Martin Erik Werner Date: Wed, 13 Feb 2013 20:58:19 +0000 (+0100) Subject: t9903: add extra tests for bash.showDirtyState X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dc7e7bced41b3a362a94cb1670ff183459d8d3a8;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index dd9ac6a82..2101d914f 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -360,11 +360,47 @@ 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"