Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit f3bd62d

Browse files
erdavilagitster
authored andcommitted
t9903: remove redundant tests
After refactoring __git_ps1_colorize_gitstring, codepaths for bash and zsh became mostly common and tests for bash and zsh became redundant. Remove tests for zsh. Keep one minimal test that stress the difference in codepaths for bash and zsh. Suggested-by: SZEDER Gábor <[email protected]> Signed-off-by: Eduardo R. D'Avila <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7fe9031 commit f3bd62d

File tree

1 file changed

+1
-114
lines changed

1 file changed

+1
-114
lines changed

t/t9903-bash-prompt.sh

Lines changed: 1 addition & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ test_expect_success 'prompt - bash color pc mode - untracked files status indica
665665
test_cmp expected "$actual"
666666
'
667667

668-
test_expect_success 'prompt - zsh color pc mode - branch name' '
668+
test_expect_success 'prompt - zsh color pc mode' '
669669
printf "BEFORE: (%%F{green}master%%f%%f):AFTER" >expected &&
670670
(
671671
ZSH_VERSION=5.0.0 &&
@@ -676,117 +676,4 @@ test_expect_success 'prompt - zsh color pc mode - branch name' '
676676
test_cmp expected "$actual"
677677
'
678678

679-
test_expect_success 'prompt - zsh color pc mode - detached head' '
680-
printf "BEFORE: (%%F{red}(%s...)%%f%%f):AFTER" $(git log -1 --format="%h" b1^) >expected &&
681-
git checkout b1^ &&
682-
test_when_finished "git checkout master" &&
683-
(
684-
ZSH_VERSION=5.0.0 &&
685-
GIT_PS1_SHOWCOLORHINTS=y &&
686-
__git_ps1 "BEFORE:" ":AFTER" &&
687-
printf "%s" "$PS1" >"$actual"
688-
) &&
689-
test_cmp expected "$actual"
690-
'
691-
692-
test_expect_success 'prompt - zsh color pc mode - dirty status indicator - dirty worktree' '
693-
printf "BEFORE: (%%F{green}master%%f %%F{red}*%%f):AFTER" >expected &&
694-
echo "dirty" >file &&
695-
test_when_finished "git reset --hard" &&
696-
(
697-
ZSH_VERSION=5.0.0 &&
698-
GIT_PS1_SHOWDIRTYSTATE=y &&
699-
GIT_PS1_SHOWCOLORHINTS=y &&
700-
__git_ps1 "BEFORE:" ":AFTER" &&
701-
printf "%s" "$PS1" >"$actual"
702-
) &&
703-
test_cmp expected "$actual"
704-
'
705-
706-
test_expect_success 'prompt - zsh color pc mode - dirty status indicator - dirty index' '
707-
printf "BEFORE: (%%F{green}master%%f %%F{green}+%%f):AFTER" >expected &&
708-
echo "dirty" >file &&
709-
test_when_finished "git reset --hard" &&
710-
git add -u &&
711-
(
712-
ZSH_VERSION=5.0.0 &&
713-
GIT_PS1_SHOWDIRTYSTATE=y &&
714-
GIT_PS1_SHOWCOLORHINTS=y &&
715-
__git_ps1 "BEFORE:" ":AFTER" &&
716-
printf "%s" "$PS1" >"$actual"
717-
) &&
718-
test_cmp expected "$actual"
719-
'
720-
721-
test_expect_success 'prompt - zsh color pc mode - dirty status indicator - dirty index and worktree' '
722-
printf "BEFORE: (%%F{green}master%%f %%F{red}*%%F{green}+%%f):AFTER" >expected &&
723-
echo "dirty index" >file &&
724-
test_when_finished "git reset --hard" &&
725-
git add -u &&
726-
echo "dirty worktree" >file &&
727-
(
728-
ZSH_VERSION=5.0.0 &&
729-
GIT_PS1_SHOWCOLORHINTS=y &&
730-
GIT_PS1_SHOWDIRTYSTATE=y &&
731-
__git_ps1 "BEFORE:" ":AFTER" &&
732-
printf "%s" "$PS1" >"$actual"
733-
) &&
734-
test_cmp expected "$actual"
735-
'
736-
737-
test_expect_success 'prompt - zsh color pc mode - dirty status indicator - before root commit' '
738-
printf "BEFORE: (%%F{green}master%%f %%F{green}#%%f):AFTER" >expected &&
739-
(
740-
ZSH_VERSION=5.0.0 &&
741-
GIT_PS1_SHOWDIRTYSTATE=y &&
742-
GIT_PS1_SHOWCOLORHINTS=y &&
743-
cd otherrepo &&
744-
__git_ps1 "BEFORE:" ":AFTER" &&
745-
printf "%s" "$PS1" >"$actual"
746-
) &&
747-
test_cmp expected "$actual"
748-
'
749-
750-
test_expect_success 'prompt - zsh color pc mode - inside .git directory' '
751-
printf "BEFORE: (%%F{green}GIT_DIR!%%f%%f):AFTER" >expected &&
752-
echo "dirty" >file &&
753-
test_when_finished "git reset --hard" &&
754-
(
755-
ZSH_VERSION=5.0.0 &&
756-
GIT_PS1_SHOWDIRTYSTATE=y &&
757-
GIT_PS1_SHOWCOLORHINTS=y &&
758-
cd .git &&
759-
__git_ps1 "BEFORE:" ":AFTER" &&
760-
printf "%s" "$PS1" >"$actual"
761-
) &&
762-
test_cmp expected "$actual"
763-
'
764-
765-
test_expect_success 'prompt - zsh color pc mode - stash status indicator' '
766-
printf "BEFORE: (%%F{green}master%%f %%F{blue}$%%f):AFTER" >expected &&
767-
echo 2 >file &&
768-
git stash &&
769-
test_when_finished "git stash drop" &&
770-
(
771-
ZSH_VERSION=5.0.0 &&
772-
GIT_PS1_SHOWSTASHSTATE=y &&
773-
GIT_PS1_SHOWCOLORHINTS=y &&
774-
__git_ps1 "BEFORE:" ":AFTER" &&
775-
printf "%s" "$PS1" >"$actual"
776-
) &&
777-
test_cmp expected "$actual"
778-
'
779-
780-
test_expect_success 'prompt - zsh color pc mode - untracked files status indicator' '
781-
printf "BEFORE: (%%F{green}master%%f %%F{red}%%%%%%f):AFTER" >expected &&
782-
(
783-
ZSH_VERSION=5.0.0 &&
784-
GIT_PS1_SHOWUNTRACKEDFILES=y &&
785-
GIT_PS1_SHOWCOLORHINTS=y &&
786-
__git_ps1 "BEFORE:" ":AFTER" &&
787-
printf "%s" "$PS1" >"$actual"
788-
) &&
789-
test_cmp expected "$actual"
790-
'
791-
792679
test_done

0 commit comments

Comments
 (0)