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>
Martin Erik Werner committed
Feb 13, 2013 at 21:58 UTC
dc7e7bced41b3a362a94cb1670ff183459d8d3a8
1 file changed
+37
-1
t/t9903-bash-prompt.sh
+37
-1
@@ -360,11 +360,47 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '
360
test_cmp expected "$actual"
361
'
362
363
-test_expect_success 'prompt - dirty status indicator - disabled by config' '
363
+test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '
364
printf " (master)" > expected &&
365
echo "dirty" > file &&
366
test_when_finished "git reset --hard" &&
367
test_config bash.showDirtyState false &&
368
+ (
369
+ sane_unset GIT_PS1_SHOWDIRTYSTATE &&
370
+ __git_ps1 > "$actual"
371
+ ) &&
372
+ test_cmp expected "$actual"
373
+'
374
+
375
+test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '
376
+ printf " (master)" > expected &&
377
+ echo "dirty" > file &&
378
+ test_when_finished "git reset --hard" &&
379
+ test_config bash.showDirtyState true &&
380
+ (
381
+ sane_unset GIT_PS1_SHOWDIRTYSTATE &&
382
+ __git_ps1 > "$actual"
383
+ ) &&
384
+ test_cmp expected "$actual"
385
+'
386
+
387
+test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '
388
+ printf " (master)" > expected &&
389
+ echo "dirty" > file &&
390
+ test_when_finished "git reset --hard" &&
391
+ test_config bash.showDirtyState false &&
392
+ (
393
+ GIT_PS1_SHOWDIRTYSTATE=y &&
394
+ __git_ps1 > "$actual"
395
+ ) &&
396
+ test_cmp expected "$actual"
397
+'
398
+
399
+test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '
400
+ printf " (master *)" > expected &&
401
+ echo "dirty" > file &&
402
+ test_when_finished "git reset --hard" &&
403
+ test_config bash.showDirtyState true &&
404
(
405
GIT_PS1_SHOWDIRTYSTATE=y &&
406
__git_ps1 > "$actual"