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 | |
| parent | c2dbe6f579bac9b40482970287e6a58783994257 (diff) | |
| download | git-sonar-e388db84ee99641a0260767ccdd4c889b7ca4f7d.tar.gz git-sonar-e388db84ee99641a0260767ccdd4c889b7ca4f7d.zip | |
Test zsh remote commit colors
| -rwxr-xr-x | radar-base.sh | 8 | ||||
| -rwxr-xr-x | test-colors.sh | 46 | 
2 files changed, 50 insertions, 4 deletions
| diff --git a/radar-base.sh b/radar-base.sh index 63a18c9..541b5e7 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -477,10 +477,10 @@ bash_color_remote_commits() {  zsh_color_remote_commits() {    local remote_master="$(printf '\xF0\x9D\x98\xAE')" # an italic m to represent master -  local green_ahead_arrow="$COLOR_REMOTE_AHEAD←$RESET_COLOR_REMOTE" -  local red_behind_arrow="$COLOR_REMOTE_BEHIND→$RESET_COLOR_REMOTE" -  local yellow_diverged_arrow="$COLOR_REMOTE_DIVERGED⇄$RESET_COLOR_REMOTE" -  local not_upstream="$COLOR_REMOTE_NOT_UPSTREAM⚡$RESET_COLOR_REMOTE" +  local green_ahead_arrow="${COLOR_REMOTE_AHEAD}←$RESET_COLOR_REMOTE" +  local red_behind_arrow="${COLOR_REMOTE_BEHIND}→$RESET_COLOR_REMOTE" +  local yellow_diverged_arrow="${COLOR_REMOTE_DIVERGED}⇄$RESET_COLOR_REMOTE" +  local not_upstream="${COLOR_REMOTE_NOT_UPSTREAM}⚡$RESET_COLOR_REMOTE"    if remote_branch="$(remote_branch_name)"; then      remote_ahead="$(remote_ahead_of_master "$remote_branch")" 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 | 
