1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 21:41:57 +00:00

Fix tests

This commit is contained in:
Dominik Ritter 2018-08-08 00:42:42 +02:00
parent 19235b2359
commit e970a021c8
9 changed files with 83 additions and 83 deletions

View file

@ -20,7 +20,7 @@ function testJoinedSegments() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined)
cd /tmp
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp %K{012}%F{000}%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
cd -
@ -30,7 +30,7 @@ function testTransitiveJoinedSegments() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined)
cd /tmp
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp %K{012}%F{000}%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
cd -
@ -40,7 +40,7 @@ function testJoiningWithConditionalSegment() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined)
cd /tmp
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp %K{012}%F{000} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
cd -
@ -51,7 +51,7 @@ function testDynamicColoringOfSegmentsWork() {
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red'
cd /tmp
assertEquals "%K{red} %F{black}/tmp %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{000}/tmp %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_DEFAULT_BACKGROUND
@ -65,7 +65,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
cd /tmp
assertEquals "%K{blue} %F{green%}icon-here %f%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{green%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR
@ -86,7 +86,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
cd /tmp
assertEquals "%K{yellow} %F{green%}icon-here %f%F{red}/tmp %k%F{yellow}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{green%}icon-here %f%F{009}/tmp %k%F{011}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR
@ -106,7 +106,7 @@ function testOverwritingIconsWork() {
#cd ~/$testFolder
cd /tmp
assertEquals "%K{blue} %F{black%}icon-here %f%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_FOLDER_ICON
@ -123,7 +123,7 @@ function testNewlineOnRpromptCanBeDisabled() {
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(custom_rworld)
powerlevel9k_prepare_prompts
assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX) world  $(print_icon MULTILINE_LAST_PROMPT_PREFIX) rworld' "$(print -P ${PROMPT}${RPROMPT})"
assertEquals '$(print_icon MULTILINE_FIRST_PROMPT_PREFIX) world  $(print_icon MULTILINE_LAST_PROMPT_PREFIX) rworld' "$(print -P ${PROMPT}${RPROMPT})"
unset POWERLEVEL9K_PROMPT_ON_NEWLINE
unset POWERLEVEL9K_RPROMPT_ON_NEWLINE

View file

@ -16,7 +16,7 @@ function testCommandExecutionTimeIsNotShownIfTimeIsBelowThreshold() {
POWERLEVEL9K_CUSTOM_WORLD='echo world'
_P9K_COMMAND_DURATION=2
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD
@ -28,7 +28,7 @@ function testCommandExecutionTimeThresholdCouldBeChanged() {
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
_P9K_COMMAND_DURATION=2.03
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}2.03 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%}Dur %f%F{226}2.03 %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset _P9K_COMMAND_DURATION
@ -40,7 +40,7 @@ function testCommandExecutionTimeThresholdCouldBeSetToZero() {
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
_P9K_COMMAND_DURATION=0.03
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.03 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.03 %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset _P9K_COMMAND_DURATION
@ -53,7 +53,7 @@ function testCommandExecutionTimePrecisionCouldBeChanged() {
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4
_P9K_COMMAND_DURATION=0.0001
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}0.0001 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.0001 %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset _P9K_COMMAND_DURATION
@ -66,7 +66,7 @@ function testCommandExecutionTimePrecisionCouldBeSetToZero() {
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
_P9K_COMMAND_DURATION=23.5001
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}23 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%}Dur %f%F{226}23 %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset _P9K_COMMAND_DURATION
@ -77,7 +77,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand()
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
_P9K_COMMAND_DURATION=180
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}03:00 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%}Dur %f%F{226}03:00 %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset _P9K_COMMAND_DURATION
@ -87,7 +87,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
_P9K_COMMAND_DURATION=7200
assertEquals "%K{red} %F{yellow1%}Dur %f%F{yellow1}02:00:00 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%}Dur %f%F{226}02:00:00 %k%F{009}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset _P9K_COMMAND_DURATION

View file

@ -22,7 +22,7 @@ function testDirPathAbsoluteWorks() {
POWERLEVEL9K_DIR_PATH_ABSOLUTE=true
cd ~
assertEquals "%K{blue} %F{black}/home/travis %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/home/travis %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_ABSOLUTE
@ -36,7 +36,7 @@ function testTruncateFoldersWorks() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/12345678/123456789 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -57,7 +57,7 @@ function testTruncateFolderWithHomeDirWorks() {
# Switch back to home folder as this causes the problem.
cd ..
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}~ %k%F{012}%f " "$(build_left_prompt)"
rmdir $FOLDER
cd ${CURRENT_DIR}
@ -75,7 +75,7 @@ function testTruncateMiddleWorks() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}/tmp/post/1/12/123/1234/1245/1256/1267/1278/123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp/post/1/12/123/1234/1245/1256/1267/1278/123456789 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -93,7 +93,7 @@ function testTruncationFromRightWorks() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -111,7 +111,7 @@ function testTruncateToLastWorks() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}123456789 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -129,7 +129,7 @@ function testTruncateToFirstAndLastWorks() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}/tmp/powerlevel9k-test////////12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp/powerlevel9k-test////////12345678/123456789 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -147,7 +147,7 @@ function testTruncateAbsoluteWorks() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}89 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}89 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -166,7 +166,7 @@ function testTruncationFromRightWithEmptyDelimiter() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -187,7 +187,7 @@ function testTruncateWithFolderMarkerWorks() {
# Setup folder marker
touch $BASEFOLDER/1/12/.shorten_folder_marker
cd $FOLDER
assertEquals "%K{blue} %F{black}//12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}//12/123/1234/12345/123456/1234567 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr $BASEFOLDER
@ -208,7 +208,7 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() {
# Setup folder marker
touch $BASEFOLDER/1/12/.xxx
cd $FOLDER
assertEquals "%K{blue} %F{black}//12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}//12/123/1234/12345/123456/1234567 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr $BASEFOLDER
@ -241,7 +241,7 @@ function testTruncateWithPackageNameWorks() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
assertEquals "%K{blue} %F{black}My_Package/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}My_Package/1/12/123/12/12/12/12/12/123456789 %k%F{012}%f " "$(build_left_prompt)"
# Go back
cd $p9kFolder
@ -280,7 +280,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
assertEquals "%K{blue} %F{black}My_Package/as/qwerqwer %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}My_Package/as/qwerqwer %k%F{012}%f " "$(build_left_prompt)"
# Go back
cd $p9kFolder
@ -315,7 +315,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
assertEquals "%K{blue} %F{black}My_Package/.g/re/heads %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}My_Package/.g/re/heads %k%F{012}%f " "$(build_left_prompt)"
# Go back
cd $p9kFolder
@ -329,7 +329,7 @@ function testHomeFolderDetectionWorks() {
POWERLEVEL9K_HOME_ICON='home-icon'
cd ~
assertEquals "%K{blue} %F{black%}home-icon %f%F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000%}home-icon %f%F{000}~ %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_HOME_ICON
@ -341,7 +341,7 @@ function testHomeSubfolderDetectionWorks() {
FOLDER=~/powerlevel9k-test
mkdir $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black%}sub-icon %f%F{black}~/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000%}sub-icon %f%F{000}~/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr $FOLDER
@ -355,7 +355,7 @@ function testOtherFolderDetectionWorks() {
FOLDER=/tmp/powerlevel9k-test
mkdir $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}/tmp/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr $FOLDER
@ -369,7 +369,7 @@ function testChangingDirPathSeparator() {
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
cd -
unset FOLDER
@ -384,20 +384,20 @@ function testHomeFolderAbbreviation() {
cd ~/
# default
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}~ %k%F{012}%f " "$(build_left_prompt)"
# substituted
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
assertEquals "%K{blue} %F{black}qQq %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}qQq %k%F{012}%f " "$(build_left_prompt)"
cd /tmp
# default
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
# substituted
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
cd "$dir"
}
@ -407,7 +407,7 @@ function testOmittingFirstCharacterWorks() {
POWERLEVEL9K_FOLDER_ICON='folder-icon'
cd /tmp
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmp %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_FOLDER_ICON
@ -421,7 +421,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -445,7 +445,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTrunc
mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{blue} %F{black}xXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}xXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -463,7 +463,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTrunca
mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{blue} %F{black}tmpxXxpostxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}tmpxXxpostxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -481,7 +481,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat
mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{blue} %F{black}tmpxXxpoxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}tmpxXxpoxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -502,7 +502,7 @@ function testTruncateToUniqueWorks() {
mkdir -p /tmp/powerlevel9k-test/bob/docs
cd /tmp/powerlevel9k-test/alice/devl
assertEquals "%K{blue} %F{black}txXxpxXxalxXxde %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}txXxpxXxalxXxde %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -516,7 +516,7 @@ function testBoldHomeDirWorks() {
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
cd ~
assertEquals "%K{blue} %F{black}%B~%b %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}%B~%b %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
@ -527,7 +527,7 @@ function testBoldHomeSubdirWorks() {
mkdir -p ~/powerlevel9k-test
cd ~/powerlevel9k-test
assertEquals "%K{blue} %F{black}~/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}~/%Bpowerlevel9k-test%b %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr ~/powerlevel9k-test
@ -538,7 +538,7 @@ function testBoldRootDirWorks() {
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
cd /
assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}%B/%b %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
@ -548,7 +548,7 @@ function testBoldRootSubdirWorks() {
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
cd /tmp
assertEquals "%K{blue} %F{black}/%Btmp%b %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/%Btmp%b %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
@ -559,7 +559,7 @@ function testBoldRootSubSubdirWorks() {
mkdir -p /tmp/powerlevel9k-test
cd /tmp/powerlevel9k-test
assertEquals "%K{blue} %F{black}/tmp/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp/%Bpowerlevel9k-test%b %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -570,7 +570,7 @@ function testHighlightHomeWorks() {
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
cd ~
assertEquals "%K{blue} %F{black}%F{red}~ %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}%F{red}~ %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
@ -581,7 +581,7 @@ function testHighlightHomeSubdirWorks() {
mkdir -p ~/powerlevel9k-test
cd ~/powerlevel9k-test
assertEquals "%K{blue} %F{black}~/%F{red}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}~/%F{red}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr ~/powerlevel9k-test
@ -592,7 +592,7 @@ function testHighlightRootWorks() {
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
cd /
assertEquals "%K{blue} %F{black}%F{red}/ %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}%F{red}/ %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
@ -602,7 +602,7 @@ function testHighlightRootSubdirWorks() {
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
cd /tmp
assertEquals "%K{blue} %F{black}/%F{red}tmp %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/%F{red}tmp %k%F{012}%f " "$(build_left_prompt)"
cd -
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
@ -613,7 +613,7 @@ function testHighlightRootSubSubdirWorks() {
mkdir /tmp/powerlevel9k-test
cd /tmp/powerlevel9k-test
assertEquals "%K{blue} %F{black}/tmp/%F{red}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}/tmp/%F{red}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -625,7 +625,7 @@ function testDirSeparatorColorHomeSubdirWorks() {
mkdir -p ~/powerlevel9k-test
cd ~/powerlevel9k-test
assertEquals "%K{blue} %F{black}~%F{red}/%F{black}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}~%F{red}/%F{black}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr ~/powerlevel9k-test
@ -637,7 +637,7 @@ function testDirSeparatorColorRootSubSubdirWorks() {
mkdir -p /tmp/powerlevel9k-test
cd /tmp/powerlevel9k-test
assertEquals "%K{blue} %F{black}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
assertEquals "%K{012} %F{000}%F{red}/%F{black}tmp%F{red}/%F{black}powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test

View file

@ -40,7 +40,7 @@ function testGo() {
PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
assertEquals "%K{green} %F{grey93%} %f%F{grey93}go1.5.3 %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{255%} %f%F{255}go1.5.3 %k%F{002}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_GO_ICON
unset PWD
@ -53,7 +53,7 @@ function testGoSegmentPrintsNothingIfEmptyGopath() {
POWERLEVEL9K_CUSTOM_WORLD='echo world'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD
@ -65,7 +65,7 @@ function testGoSegmentPrintsNothingIfNotInGopath() {
POWERLEVEL9K_CUSTOM_WORLD='echo world'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD
@ -76,7 +76,7 @@ function testGoSegmentPrintsNothingIfGoIsNotAvailable() {
POWERLEVEL9K_CUSTOM_WORLD='echo world'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world go_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD

View file

@ -69,7 +69,7 @@ function testKubeContext() {
alias kubectl=mockKubectl
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
assertEquals "%K{magenta} %F{white%} %f%F{white}minikube/default %k%F{magenta}%f " "$(build_left_prompt)"
assertEquals "%K{013} %F{015%} %f%F{015}minikube/default %k%F{013}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias kubectl
@ -78,7 +78,7 @@ function testKubeContextOtherNamespace() {
alias kubectl=mockKubectlOtherNamespace
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
assertEquals "%K{magenta} %F{white%} %f%F{white}minikube/kube-system %k%F{magenta}%f " "$(build_left_prompt)"
assertEquals "%K{013} %F{015%} %f%F{015}minikube/kube-system %k%F{013}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias kubectl
@ -88,7 +88,7 @@ function testKubeContextPrintsNothingIfKubectlNotAvailable() {
POWERLEVEL9K_CUSTOM_WORLD='echo world'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world kubecontext)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD

View file

@ -31,7 +31,7 @@ function testLaravelVersionSegment() {
POWERLEVEL9K_LARAVEL_ICON='x'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(laravel_version)
assertEquals "%K{001} %F{white%}x %f%F{white}5.4.23 %k%F{maroon}%f " "$(build_left_prompt)"
assertEquals "%K{001} %F{015%}x %f%F{015}5.4.23 %k%F{001}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_LARAVEL_ICON
@ -44,7 +44,7 @@ function testLaravelVersionSegmentIfArtisanIsNotAvailable() {
POWERLEVEL9K_LARAVEL_ICON='x'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world laravel_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_LARAVEL_ICON
@ -58,7 +58,7 @@ function testLaravelVersionSegmentPrintsNothingIfPhpIsNotAvailable() {
POWERLEVEL9K_LARAVEL_ICON='x'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world laravel_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_LARAVEL_ICON

View file

@ -32,7 +32,7 @@ function testRust() {
mockRust
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
assertEquals "%K{208} %F{black%}Rust %f%F{black}0.4.1a-alpha %k%F{darkorange}%f " "$(build_left_prompt)"
assertEquals "%K{208} %F{000%}Rust %f%F{000}0.4.1a-alpha %k%F{208}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
}
@ -41,7 +41,7 @@ function testRustPrintsNothingIfRustIsNotAvailable() {
POWERLEVEL9K_CUSTOM_WORLD='echo world'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world rust_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD

View file

@ -22,7 +22,7 @@ function testStatusPrintsNothingIfReturnCodeIsZeroAndVerboseIsUnset() {
local POWERLEVEL9K_STATUS_VERBOSE=false
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{000}world %k%F{015}%f " "$(build_left_prompt)"
}
function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
@ -31,7 +31,7 @@ function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
assertEquals "%K{black} %F{green%}%f %k%F{black}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{002%}%f %k%F{000}%f " "$(build_left_prompt)"
}
function testStatusInGeneralErrorCase() {
@ -40,7 +40,7 @@ function testStatusInGeneralErrorCase() {
local POWERLEVEL9K_STATUS_VERBOSE=true
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
assertEquals "%K{red} %F{yellow1%} %f%F{yellow1}1 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%} %f%F{226}1 %k%F{009}%f " "$(build_left_prompt)"
}
function testPipestatusInErrorCase() {
@ -50,7 +50,7 @@ function testPipestatusInErrorCase() {
local POWERLEVEL9K_STATUS_VERBOSE=true
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
assertEquals "%K{red} %F{yellow1%} %f%F{yellow1}0|0|1|0 %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%} %f%F{226}0|0|1|0 %k%F{009}%f " "$(build_left_prompt)"
}
function testStatusCrossWinsOverVerbose() {
@ -60,7 +60,7 @@ function testStatusCrossWinsOverVerbose() {
local POWERLEVEL9K_STATUS_VERBOSE=true
local POWERLEVEL9K_STATUS_CROSS=true
assertEquals "%K{black} %F{red%}%f %k%F{black}%f " "$(build_left_prompt)"
assertEquals "%K{000} %F{009%}%f %k%F{000}%f " "$(build_left_prompt)"
}
function testStatusShowsSignalNameInErrorCase() {
@ -70,7 +70,7 @@ function testStatusShowsSignalNameInErrorCase() {
local POWERLEVEL9K_STATUS_VERBOSE=true
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
assertEquals "%K{red} %F{yellow1%} %f%F{yellow1}SIGILL(4) %k%F{red}%f " "$(build_left_prompt)"
assertEquals "%K{009} %F{226%} %f%F{226}SIGILL(4) %k%F{009}%f " "$(build_left_prompt)"
}
function testStatusSegmentIntegrated() {
@ -79,7 +79,7 @@ function testStatusSegmentIntegrated() {
false; powerlevel9k_prepare_prompts
assertEquals "%f%b%k%K{black} %F{red%}%f %k%F{black}%f " "${(e)PROMPT}"
assertEquals "%f%b%k%K{000} %F{009%}%f %k%F{000}%f " "${(e)PROMPT}"
}
source shunit2/source/2.1/src/shunit2

View file

@ -21,7 +21,7 @@ function testColorOverridingForCleanStateWorks() {
cd $FOLDER
git init 1>/dev/null
assertEquals "%K{white} %F{cyan} master %k%F{white}%f " "$(build_left_prompt)"
assertEquals "%K{015} %F{014} master %k%F{015}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -47,7 +47,7 @@ function testColorOverridingForModifiedStateWorks() {
git commit -m "test" 1>/dev/null
echo "test" > testfile
assertEquals "%K{yellow} %F{red} master %k%F{yellow}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{009} master %k%F{011}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -68,7 +68,7 @@ function testColorOverridingForUntrackedStateWorks() {
git init 1>/dev/null
touch testfile
assertEquals "%K{yellow} %F{cyan} master ? %k%F{yellow}%f " "$(build_left_prompt)"
assertEquals "%K{011} %F{014} master ? %k%F{011}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -90,10 +90,10 @@ function testBranchNameTruncatingShortenLength() {
git init 1>/dev/null
touch testfile
assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
POWERLEVEL9K_VCS_SHORTEN_LENGTH=3
assertEquals "%K{green} %F{black} mas ? %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000} mas ? %k%F{002}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -116,11 +116,11 @@ function testBranchNameTruncatingMinLength() {
git init 1>/dev/null
touch testfile
assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH=7
assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
@ -143,11 +143,11 @@ function testBranchNameTruncatingShortenStrategy() {
git init 1>/dev/null
touch testfile
assertEquals "%K{green} %F{black} mas ? %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000} mas ? %k%F{002}%f " "$(build_left_prompt)"
POWERLEVEL9K_VCS_SHORTEN_STRATEGY="truncate_middle"
assertEquals "%K{green} %F{black} master ? %k%F{green}%f " "$(build_left_prompt)"
assertEquals "%K{002} %F{000} master ? %k%F{002}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test