diff options
author | Michael Allen <michael@michaelallen.io> | 2015-08-30 19:22:50 +0100 |
---|---|---|
committer | Michael Allen <michael@michaelallen.io> | 2015-08-30 19:35:12 +0100 |
commit | e388db84ee99641a0260767ccdd4c889b7ca4f7d (patch) | |
tree | 0e53caaf987fc50c1a6e570e8450f03fa442675a /test-colors.sh | |
parent | c2dbe6f579bac9b40482970287e6a58783994257 (diff) | |
download | git-sonar-e388db84ee99641a0260767ccdd4c889b7ca4f7d.tar.gz git-sonar-e388db84ee99641a0260767ccdd4c889b7ca4f7d.zip |
Test zsh remote commit colors
Diffstat (limited to 'test-colors.sh')
-rwxr-xr-x | test-colors.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test-colors.sh b/test-colors.sh index efcdea9..6b8a797 100755 --- a/test-colors.sh +++ b/test-colors.sh @@ -127,4 +127,50 @@ test_zsh_colors_local() { rm_tmp } + +test_zsh_colors_remote() { + set_zsh_env_vars + prepare_zsh_colors + + cd_to_tmp "remote" + git init --bare --quiet + remoteLocation="$(pwd)" + + cd_to_tmp "repo" + git init --quiet + git remote add origin $remoteLocation + git fetch origin --quiet + git checkout -b master --quiet + touch README + git add README + git commit -m "initial commit" --quiet + echo "foo" > foo + git add . + git commit -m "test commit" --quiet + git push --quiet -u origin master >/dev/null + repoLocation="$(pwd)" + + git reset --hard head^ --quiet >/dev/null + git checkout -b mybranch --quiet + git push --quiet -u origin mybranch >/dev/null + + printf -v m '\xF0\x9D\x98\xAE' + + assertEquals "$m 1 %{remote-behind%}→%{remote-reset%} " "$(zsh_color_remote_commits)" + + echo "bar" > bar + git add . + git commit -m "new commit" --quiet + git push --quiet >/dev/null + + assertEquals "$m 1 %{remote-diverged%}⇄%{remote-reset%} 1 " "$(zsh_color_remote_commits)" + + git pull origin master --quiet >/dev/null + git push --quiet >/dev/null + + assertEquals "$m %{remote-ahead%}←%{remote-reset%} 2 " "$(zsh_color_remote_commits)" + + rm_tmp +} + . ./shunit/shunit2 |