t9903: add tests for bash.showUntrackedFiles

Add 4 tests for the bash.showUntrackedFiles config option, covering all combinations of the shell var being set/unset and the config option being enabled/disabled (the other 2 cases, missing config with and without shell variable, are already covered by existing tests). Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Erik Werner committed Feb 13, 2013 at 21:58 UTC 58978e822c5a6bacba19641626e1907139f5d99b
1 file changed +40
t/t9903-bash-prompt.sh
+40
@@ -437,6 +437,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
437 test_cmp expected "$actual"
438 '
439
440 +test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
441 + printf " (master)" > expected &&
442 + test_config bash.showUntrackedFiles false &&
443 + (
444 + sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
445 + __git_ps1 > "$actual"
446 + ) &&
447 + test_cmp expected "$actual"
448 +'
449 +
450 +test_expect_success 'prompt - untracked files status indicator - shell variable unset with config enabled' '
451 + printf " (master)" > expected &&
452 + test_config bash.showUntrackedFiles true &&
453 + (
454 + sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
455 + __git_ps1 > "$actual"
456 + ) &&
457 + test_cmp expected "$actual"
458 +'
459 +
460 +test_expect_success 'prompt - untracked files status indicator - shell variable set with config disabled' '
461 + printf " (master)" > expected &&
462 + test_config bash.showUntrackedFiles false &&
463 + (
464 + GIT_PS1_SHOWUNTRACKEDFILES=y &&
465 + __git_ps1 > "$actual"
466 + ) &&
467 + test_cmp expected "$actual"
468 +'
469 +
470 +test_expect_success 'prompt - untracked files status indicator - shell variable set with config enabled' '
471 + printf " (master %%)" > expected &&
472 + test_config bash.showUntrackedFiles true &&
473 + (
474 + GIT_PS1_SHOWUNTRACKEDFILES=y &&
475 + __git_ps1 > "$actual"
476 + ) &&
477 + test_cmp expected "$actual"
478 +'
479 +
480 test_expect_success 'prompt - untracked files status indicator - not shown inside .git directory' '
481 printf " (GIT_DIR!)" > expected &&
482 (