aboutsummaryrefslogtreecommitdiff
path: root/test/segments
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2016-02-26 17:53:59 +0300
committerBen Hilburn <bhilburn@gmail.com>2016-02-26 17:53:59 +0300
commitb3fae488934fef856805a9012f08fb4146764aa6 (patch)
tree5448ff41748b48091ae1fd25df2916297f66eb06 /test/segments
parent5d31763a8eab213cdcf59d76283b34e75fd93d4d (diff)
parentcb5d33affb4fb223ec29f6dfb89ff8b0bb6e9133 (diff)
Merge pull request #220 from dritter/rename_vcs_default_state
Rename vcs default state
Diffstat (limited to 'test/segments')
-rwxr-xr-xtest/segments/vcs.spec77
1 files changed, 77 insertions, 0 deletions
diff --git a/test/segments/vcs.spec b/test/segments/vcs.spec
new file mode 100755
index 00000000..862067b7
--- /dev/null
+++ b/test/segments/vcs.spec
@@ -0,0 +1,77 @@
+#!/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
+ touch testfile
+ git add 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
+}
+
+source shunit2/source/2.1/src/shunit2