diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-07-25 08:52:06 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-07-25 08:52:06 +0300 |
commit | 06de83cc0f2282b2217c6151277dfd6789593c2e (patch) | |
tree | 8e7d013b2f66f9431b732f64fe8c8c5c8a87e7c5 /test/segments/vcs-git.spec | |
parent | 99f0eddd62806f99b8116e3f327689bc32529d5d (diff) |
Prepare tests for performance optimizations
Diffstat (limited to 'test/segments/vcs-git.spec')
-rwxr-xr-x | test/segments/vcs-git.spec | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/test/segments/vcs-git.spec b/test/segments/vcs-git.spec index 3ae4077e..f78012dd 100755 --- a/test/segments/vcs-git.spec +++ b/test/segments/vcs-git.spec @@ -7,8 +7,6 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme P9K_HOME=$(pwd) ### Test specific @@ -75,6 +73,9 @@ function testColorOverridingForCleanStateWorks() { local POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' local POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{white} %F{cyan} master %k%F{white}%f " "$(build_left_prompt)" } @@ -88,6 +89,9 @@ function testColorOverridingForModifiedStateWorks() { git add testfile git commit -m "test" 1>/dev/null echo "test" > testfile + + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme assertEquals "%K{yellow} %F{red} master ● %k%F{yellow}%f " "$(build_left_prompt)" } @@ -100,6 +104,9 @@ function testColorOverridingForUntrackedStateWorks() { touch testfile + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{yellow} %F{cyan} master ? %k%F{yellow}%f " "$(build_left_prompt)" } @@ -107,6 +114,9 @@ function testGitIconWorks() { local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) local POWERLEVEL9K_VCS_GIT_ICON='Git-Icon' + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black%}Git-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)" } @@ -119,6 +129,9 @@ function testGitlabIconWorks() { # sufficient to show the GitLab-specific icon. git remote add origin https://gitlab.com/dritter/gitlab-test-project.git + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black%}GL-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)" } @@ -131,6 +144,9 @@ function testBitbucketIconWorks() { # sufficient to show the BitBucket-specific icon. git remote add origin https://dritter@bitbucket.org/dritter/dr-test.git + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black%}BB-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)" } @@ -143,6 +159,9 @@ function testGitHubIconWorks() { # sufficient to show the GitHub-specific icon. git remote add origin https://github.com/dritter/test.git + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black%}GH-Icon %f%F{black} master %k%F{green}%f " "$(build_left_prompt)" } @@ -154,6 +173,9 @@ function testUntrackedFilesIconWorks() { # Create untracked file touch "i-am-untracked.txt" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" } @@ -169,7 +191,10 @@ function testStagedFilesIconWorks() { echo "xx" >> i-am-added.txt git add i-am-added.txt &>/dev/null - assertEquals "%K{yellow} %F{black} master ✚ %k%F{yellow}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{yellow} %F{black} master + %k%F{yellow}%f " "$(build_left_prompt)" } function testUnstagedFilesIconWorks() { @@ -183,7 +208,10 @@ function testUnstagedFilesIconWorks() { git commit -m "Add File" 1>/dev/null echo "xx" > i-am-modified.txt - assertEquals "%K{yellow} %F{black} master ● %k%F{yellow}%f " "$(build_left_prompt)" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + + assertEquals "%K{yellow} %F{black} master M %k%F{yellow}%f " "$(build_left_prompt)" } function testStashIconWorks() { @@ -198,6 +226,9 @@ function testStashIconWorks() { echo "xx" > i-am-modified.txt git stash 1>/dev/null + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black} master S1 %k%F{green}%f " "$(build_left_prompt)" } @@ -211,6 +242,9 @@ function testTagIconWorks() { git commit -m "Add File" 1>/dev/null git tag "v0.0.1" + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black} master Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)" } @@ -229,6 +263,9 @@ function testTagIconInDetachedHeadState() { git checkout v0.0.1 &>/dev/null local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD) + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black} ${hash} Tv0.0.1 %k%F{green}%f " "$(build_left_prompt)" } @@ -249,6 +286,9 @@ function testActionHintWorks() { git commit -a -m "Provoke conflict" &>/dev/null git pull &>/dev/null + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{yellow} %F{black} master %F{red}| merge%f %k%F{yellow}%f " "$(build_left_prompt)" } @@ -268,6 +308,9 @@ function testIncomingHintWorks() { cd ../vcs-test2 git fetch &>/dev/null + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black} master I1 %k%F{green}%f " "$(build_left_prompt)" } @@ -287,6 +330,9 @@ function testOutgoingHintWorks() { echo "xx" >> i-am-modified.txt git commit -a -m "Modified file" &>/dev/null + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + assertEquals "%K{green} %F{black} master o1 %k%F{green}%f " "$(build_left_prompt)" } @@ -301,6 +347,9 @@ function testShorteningCommitHashWorks() { git commit -m "Add File" 1>/dev/null local hash=$(git rev-list -n 1 --abbrev-commit --abbrev=3 HEAD) + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + # This test needs to call powerlevel9k_vcs_init, where # the changeset is truncated. powerlevel9k_vcs_init @@ -317,6 +366,9 @@ function testShorteningCommitHashIsNotShownIfShowChangesetIsFalse() { git add file.txt git commit -m "Add File" 1>/dev/null + # Load Powerlevel9k + source ${P9K_HOME}/powerlevel9k.zsh-theme + # This test needs to call powerlevel9k_vcs_init, where # the changeset is truncated. powerlevel9k_vcs_init |