diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2018-08-31 22:43:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 22:43:20 +0300 |
commit | e207dec8de036112fcac8b8face41e87e1d0b7ec (patch) | |
tree | cf455c0cb6d45464008d1b14877cef910a368ea6 /test/segments/vcs.spec | |
parent | 571a859413866897cf962396f02f65a288f677ac (diff) | |
parent | 69c69b9cd91d77178324a86d8924efccadaa7247 (diff) |
Merge pull request #944 from dritter/prepare_066
Preparing for v0.6.6 release!
Diffstat (limited to 'test/segments/vcs.spec')
-rwxr-xr-x | test/segments/vcs.spec | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/test/segments/vcs.spec b/test/segments/vcs.spec deleted file mode 100755 index f6474f61..00000000 --- a/test/segments/vcs.spec +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env zsh -#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8 - -# Required for shunit2 to run correctly -setopt shwordsplit -SHUNIT_PARENT=$0 - -function setUp() { - export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme -} - -function testColorOverridingForCleanStateWorks() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' - POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - - assertEquals "%K{white} %F{cyan} master %k%F{white}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_CLEAN_FOREGROUND - unset POWERLEVEL9K_VCS_CLEAN_BACKGROUND -} - -function testColorOverridingForModifiedStateWorks() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='red' - POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - git config user.email "test@powerlevel9k.theme" - git config user.name "Testing Tester" - touch testfile - git add testfile - git commit -m "test" 1>/dev/null - echo "test" > testfile - - assertEquals "%K{yellow} %F{red} master ● %k%F{yellow}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_MODIFIED_FOREGROUND - unset POWERLEVEL9K_VCS_MODIFIED_BACKGROUND -} - -function testColorOverridingForUntrackedStateWorks() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='cyan' - POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow' - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{yellow} %F{cyan} master ? %k%F{yellow}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND - unset POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND -} - -function testBranchNameTruncatingShortenLength() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_SHORTEN_LENGTH=6 - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right" - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" - - POWERLEVEL9K_VCS_SHORTEN_LENGTH=3 - assertEquals "%K{green} %F{black} mas… ? %k%F{green}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_SHORTEN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_STRATEGY -} - -function testBranchNameTruncatingMinLength() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_SHORTEN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=6 - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right" - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" - - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=7 - - assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_SHORTEN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_STRATEGY -} - -function testBranchNameTruncatingShortenStrategy() { - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs) - POWERLEVEL9K_VCS_SHORTEN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=3 - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_from_right" - - FOLDER=/tmp/powerlevel9k-test/vcs-test - mkdir -p $FOLDER - cd $FOLDER - git init 1>/dev/null - touch testfile - - assertEquals "%K{green} %F{black} mas… ? %k%F{green}%f " "$(build_left_prompt)" - - POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_middle" - - assertEquals "%K{green} %F{black} mas…ter ? %k%F{green}%f " "$(build_left_prompt)" - - cd - - rm -fr /tmp/powerlevel9k-test - - unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - unset POWERLEVEL9K_VCS_SHORTEN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH - unset POWERLEVEL9K_VCS_SHORTEN_STRATEGY -} - -source shunit2/source/2.1/src/shunit2 |