Updated tests for resetting bold

Updated tests to include the `%b%K{blue}%F{black}` or similar.
TODO: Still have to create a test for a bolded last segment
pull/22/head
Christo Kotze 7 years ago
parent cd1387f530
commit 69e55a30b3

@ -20,7 +20,7 @@ function testJoinedSegments() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined) POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_joined)
cd /tmp cd /tmp
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/tmp%b%K{blue}%F{black} %K{blue}%F{black}%F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
cd - cd -
@ -30,7 +30,7 @@ function testTransitiveJoinedSegments() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined) POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir root_indicator_joined dir_joined)
cd /tmp cd /tmp
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black}%F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/tmp%b%K{blue}%F{black} %K{blue}%F{black}%F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
cd - cd -
@ -40,7 +40,7 @@ function testJoiningWithConditionalSegment() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined) POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir background_jobs dir_joined)
cd /tmp cd /tmp
assertEquals "%K{blue} %F{black}/tmp %K{blue}%F{black} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/tmp%b%K{blue}%F{black} %K{blue}%F{black} %F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
cd - cd -
@ -51,7 +51,7 @@ function testDynamicColoringOfSegmentsWork() {
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red' POWERLEVEL9K_DIR_DEFAULT_BACKGROUND='red'
cd /tmp cd /tmp
assertEquals "%K{red} %F{black}/tmp %k%F{red}%f " "$(build_left_prompt)" assertEquals "%K{red} %F{black}/tmp%b%K{red}%F{black} %k%F{red}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_DEFAULT_BACKGROUND unset POWERLEVEL9K_DIR_DEFAULT_BACKGROUND
@ -65,7 +65,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
cd /tmp cd /tmp
assertEquals "%K{blue} %F{green%}icon-here%f %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{green%}icon-here%f %F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR
@ -86,7 +86,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
cd /tmp cd /tmp
assertEquals "%K{yellow} %F{green%}icon-here%f %F{red}/tmp %k%F{yellow}%f " "$(build_left_prompt)" assertEquals "%K{yellow} %F{green%}icon-here%f %F{red}/tmp%b%K{blue}%F{black} %k%F{yellow}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR unset POWERLEVEL9K_DIR_DEFAULT_VISUAL_IDENTIFIER_COLOR
@ -106,7 +106,7 @@ function testOverwritingIconsWork() {
#cd ~/$testFolder #cd ~/$testFolder
cd /tmp cd /tmp
assertEquals "%K{blue} %F{black%}icon-here%f %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black%}icon-here%f %F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_DIR_FOLDER_ICON unset POWERLEVEL9K_DIR_FOLDER_ICON

@ -26,7 +26,7 @@ function testTruncateFoldersWorks() {
mkdir -p $FOLDER mkdir -p $FOLDER
cd $FOLDER cd $FOLDER
assertEquals "%K{blue} %F{black}…/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}…/12345678/123456789%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -44,7 +44,7 @@ function testTruncateMiddleWorks() {
mkdir -p $FOLDER mkdir -p $FOLDER
cd $FOLDER cd $FOLDER
assertEquals "%K{blue} %F{black}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/tmp/po…st/1/12/123/1234/12…45/12…56/12…67/12…78/123456789%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -62,7 +62,7 @@ function testTruncationFromRightWorks() {
mkdir -p $FOLDER mkdir -p $FOLDER
cd $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{blue} %F{black}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -81,7 +81,7 @@ function testTruncationFromRightWithEmptyDelimiter() {
mkdir -p $FOLDER mkdir -p $FOLDER
cd $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{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -102,7 +102,7 @@ function testTruncateWithFolderMarkerWorks() {
# Setup folder marker # Setup folder marker
touch $BASEFOLDER/1/12/.shorten_folder_marker touch $BASEFOLDER/1/12/.shorten_folder_marker
cd $FOLDER cd $FOLDER
assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr $BASEFOLDER rm -fr $BASEFOLDER
@ -123,7 +123,7 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() {
# Setup folder marker # Setup folder marker
touch $BASEFOLDER/1/12/.xxx touch $BASEFOLDER/1/12/.xxx
cd $FOLDER cd $FOLDER
assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr $BASEFOLDER rm -fr $BASEFOLDER
@ -156,7 +156,7 @@ function testTruncateWithPackageNameWorks() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' 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{blue} %F{black}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
# Go back # Go back
cd $p9kFolder cd $p9kFolder
@ -195,7 +195,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' 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{blue} %F{black}My_Package/as…/qwerqwer%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
# Go back # Go back
cd $p9kFolder cd $p9kFolder
@ -230,7 +230,7 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name' 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{blue} %F{black}My_Package/.g…/re…/heads%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
# Go back # Go back
cd $p9kFolder cd $p9kFolder
@ -256,7 +256,7 @@ function testHomeSubfolderDetectionWorks() {
FOLDER=~/powerlevel9k-test FOLDER=~/powerlevel9k-test
mkdir $FOLDER mkdir $FOLDER
cd $FOLDER cd $FOLDER
assertEquals "%K{blue} %F{black%}sub-icon%f %F{black}~/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black%}sub-icon%f %F{black}~/powerlevel9k-test%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr $FOLDER rm -fr $FOLDER
@ -270,7 +270,7 @@ function testOtherFolderDetectionWorks() {
FOLDER=/tmp/powerlevel9k-test FOLDER=/tmp/powerlevel9k-test
mkdir $FOLDER mkdir $FOLDER
cd $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{blue} %F{black%}folder-icon%f %F{black}/tmp/powerlevel9k-test%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr $FOLDER rm -fr $FOLDER
@ -284,7 +284,7 @@ function testChangingDirPathSeparator() {
mkdir -p $FOLDER mkdir -p $FOLDER
cd $FOLDER cd $FOLDER
assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
unset FOLDER unset FOLDER
@ -299,20 +299,20 @@ function testHomeFolderAbbreviation() {
cd ~/ cd ~/
# default # default
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~' POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}~%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
# substituted # substituted
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
assertEquals "%K{blue} %F{black}qQq %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}qQq%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd /tmp cd /tmp
# default # default
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~' POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
# substituted # substituted
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq' POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='qQq'
assertEquals "%K{blue} %F{black}/tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}/tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd "$dir" cd "$dir"
} }
@ -322,7 +322,7 @@ function testOmittingFirstCharacterWorks() {
POWERLEVEL9K_FOLDER_ICON='folder-icon' POWERLEVEL9K_FOLDER_ICON='folder-icon'
cd /tmp cd /tmp
assertEquals "%K{blue} %F{black%}folder-icon%f %F{black}tmp %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black%}folder-icon%f %F{black}tmp%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
unset POWERLEVEL9K_FOLDER_ICON unset POWERLEVEL9K_FOLDER_ICON
@ -336,7 +336,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
mkdir -p /tmp/powerlevel9k-test/1/2 mkdir -p /tmp/powerlevel9k-test/1/2
cd /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{blue} %F{black%}folder-icon%f %F{black}tmpxXxpowerlevel9k-testxXx1xXx2%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -360,7 +360,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTrunc
mkdir -p /tmp/powerlevel9k-test/1/2 mkdir -p /tmp/powerlevel9k-test/1/2
cd /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{blue} %F{black}xXx1xXx2%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -378,7 +378,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTrunca
mkdir -p /tmp/powerlevel9k-test/1/2 mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{blue} %F{black}tmpxXxpo…stxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}tmpxXxpo…stxXx1xXx2%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -396,7 +396,7 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat
mkdir -p /tmp/powerlevel9k-test/1/2 mkdir -p /tmp/powerlevel9k-test/1/2
cd /tmp/powerlevel9k-test/1/2 cd /tmp/powerlevel9k-test/1/2
assertEquals "%K{blue} %F{black}tmpxXxpo…xXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}tmpxXxpo…xXx1xXx2%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test
@ -417,7 +417,7 @@ function testTruncateToUniqueWorks() {
mkdir -p /tmp/powerlevel9k-test/bob/docs mkdir -p /tmp/powerlevel9k-test/bob/docs
cd /tmp/powerlevel9k-test/alice/devl cd /tmp/powerlevel9k-test/alice/devl
assertEquals "%K{blue} %F{black}txXxpxXxalxXxde %k%F{blue}%f " "$(build_left_prompt)" assertEquals "%K{blue} %F{black}txXxpxXxalxXxde%b%K{blue}%F{black} %k%F{blue}%f " "$(build_left_prompt)"
cd - cd -
rm -fr /tmp/powerlevel9k-test rm -fr /tmp/powerlevel9k-test

Loading…
Cancel
Save