Fix tests

This commit is contained in:
Dominik Ritter 2018-08-17 18:53:26 +02:00
commit df0c2198a0
37 changed files with 207 additions and 207 deletions

View file

@ -16,7 +16,7 @@ function testDynamicColoringOfSegmentsWork() {
local POWERLEVEL9K_DATE_ICON="date-icon"
local POWERLEVEL9K_DATE_BACKGROUND='red'
assertEquals "%K{009} %F{000}date-icon %f%F{000}%D{%d.%m.%y} %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{001} %F{000}date-icon %f%F{000}%D{%d.%m.%y} %k%F{001}%f " "$(build_left_prompt)"
}
function testDynamicColoringOfVisualIdentifiersWork() {
@ -24,7 +24,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
local POWERLEVEL9K_DATE_ICON="date-icon"
local POWERLEVEL9K_DATE_VISUAL_IDENTIFIER_COLOR='green'
assertEquals "%K{015} %F{002}date-icon %f%F{000}%D{%d.%m.%y} %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{002}date-icon %f%F{000}%D{%d.%m.%y} %k%F{007}%f " "$(build_left_prompt)"
}
function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
@ -34,7 +34,7 @@ function testColoringOfVisualIdentifiersDoesNotOverwriteColoringOfSegment() {
local POWERLEVEL9K_DATE_FOREGROUND='red'
local POWERLEVEL9K_DATE_BACKGROUND='yellow'
assertEquals "%K{011} %F{002}date-icon %f%F{009}%D{%d.%m.%y} %k%F{011}%f " "$(build_left_prompt)"
assertEquals "%K{003} %F{002}date-icon %f%F{001}%D{%d.%m.%y} %k%F{003}%f " "$(build_left_prompt)"
}
function testColorOverridingOfStatefulSegment() {
@ -45,7 +45,7 @@ function testColorOverridingOfStatefulSegment() {
# Provoke state
local SSH_CLIENT="x"
assertEquals "%K{009} %F{002}ssh-icon %f%F{002}%m %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{001} %F{002}ssh-icon %f%F{002}%m %k%F{001}%f " "$(build_left_prompt)"
}
function testColorOverridingOfCustomSegment() {
@ -56,7 +56,7 @@ function testColorOverridingOfCustomSegment() {
local POWERLEVEL9K_CUSTOM_WORLD_FOREGROUND='red'
local POWERLEVEL9K_CUSTOM_WORLD_BACKGROUND='red'
assertEquals "%K{009} %F{002}CW %f%F{009}world %k%F{009}%f " "$(build_left_prompt)"
assertEquals "%K{001} %F{002}CW %f%F{001}world %k%F{001}%f " "$(build_left_prompt)"
}
source shunit2/shunit2

View file

@ -21,7 +21,7 @@ function testLeftNormalSegmentsShouldNotBeJoined() {
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world2 %K{015}%F{000} %F{000}world4 %K{015}%F{000} %F{000}world6 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world2 %K{007}%F{000} %F{000}world4 %K{007}%F{000} %F{000}world6 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftJoinedSegments() {
@ -30,7 +30,7 @@ function testLeftJoinedSegments() {
local POWERLEVEL9K_CUSTOM_WORLD1="echo world1"
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftTransitiveJoinedSegments() {
@ -40,7 +40,7 @@ function testLeftTransitiveJoinedSegments() {
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %K{015}%F{000}%F{000}world3 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %K{007}%F{000}%F{000}world3 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftTransitiveJoiningWithConditionalJoinedSegment() {
@ -51,7 +51,7 @@ function testLeftTransitiveJoiningWithConditionalJoinedSegment() {
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000}%F{000}world2 %K{015}%F{000}%F{000}world4 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000}%F{000}world2 %K{007}%F{000}%F{000}world4 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftPromotingSegmentWithConditionalPredecessor() {
@ -61,7 +61,7 @@ function testLeftPromotingSegmentWithConditionalPredecessor() {
local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world3 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world3 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftPromotingSegmentWithJoinedConditionalPredecessor() {
@ -72,7 +72,7 @@ function testLeftPromotingSegmentWithJoinedConditionalPredecessor() {
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world4 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() {
@ -85,7 +85,7 @@ function testLeftPromotingSegmentWithDeepJoinedConditionalPredecessor() {
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
assertEquals "%K{015} %F{000}world1 %K{015}%F{000} %F{000}world4 %K{015}%F{000}%F{000}world6 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %K{007}%F{000} %F{000}world4 %K{007}%F{000}%F{000}world6 %k%F{007}%f " "$(build_left_prompt)"
}
function testLeftJoiningBuiltinSegmentWorks() {
@ -108,7 +108,7 @@ function testRightNormalSegmentsShouldNotBeJoined() {
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world2 %f%F{000}%f%K{015}%F{000} world4 %f%F{000}%f%K{015}%F{000} world6%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world2 %f%F{000}%f%K{007}%F{000} world4 %f%F{000}%f%K{007}%F{000} world6%E" "$(build_right_prompt)"
}
function testRightJoinedSegments() {
@ -117,7 +117,7 @@ function testRightJoinedSegments() {
local POWERLEVEL9K_CUSTOM_WORLD1="echo world1"
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2%E" "$(build_right_prompt)"
}
function testRightTransitiveJoinedSegments() {
@ -127,7 +127,7 @@ function testRightTransitiveJoinedSegments() {
local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2 %f%K{015}%F{000}world3%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2 %f%K{007}%F{000}world3%E" "$(build_right_prompt)"
}
function testRightTransitiveJoiningWithConditionalJoinedSegment() {
@ -138,7 +138,7 @@ function testRightTransitiveJoiningWithConditionalJoinedSegment() {
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%K{015}%F{000}world2 %f%K{015}%F{000}world4%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%K{007}%F{000}world2 %f%K{007}%F{000}world4%E" "$(build_right_prompt)"
}
function testRightPromotingSegmentWithConditionalPredecessor() {
@ -148,7 +148,7 @@ function testRightPromotingSegmentWithConditionalPredecessor() {
local POWERLEVEL9K_CUSTOM_WORLD2="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD3="echo world3"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world3%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world3%E" "$(build_right_prompt)"
}
function testRightPromotingSegmentWithJoinedConditionalPredecessor() {
@ -159,7 +159,7 @@ function testRightPromotingSegmentWithJoinedConditionalPredecessor() {
local POWERLEVEL9K_CUSTOM_WORLD3="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD4="echo world4"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world4%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4%E" "$(build_right_prompt)"
}
function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() {
@ -172,7 +172,7 @@ function testRightPromotingSegmentWithDeepJoinedConditionalPredecessor() {
local POWERLEVEL9K_CUSTOM_WORLD5="echo " # Print nothing to simulate unmet conditions
local POWERLEVEL9K_CUSTOM_WORLD6="echo world6"
assertEquals "%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world4 %f%K{015}%F{000}world6%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world4 %f%K{007}%F{000}world6%E" "$(build_right_prompt)"
}
function testRightJoiningBuiltinSegmentWorks() {

View file

@ -22,7 +22,7 @@ function testSegmentOnRightSide() {
powerlevel9k_prepare_prompts
local reset_attributes=$'\e[00m'
assertEquals "%f%b%k%F{015}%f%K{015}%F{000} world1 %f%F{000}%f%K{015}%F{000} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}"
assertEquals "%f%b%k%F{007}%f%K{007}%F{000} world1 %f%F{000}%f%K{007}%F{000} world2%E%{${reset_attributes}%}" "${(e)RPROMPT}"
}
function testDisablingRightPrompt() {
@ -48,7 +48,7 @@ function testLeftMultilinePrompt() {
powerlevel9k_prepare_prompts
local nl=$'\n'
assertEquals "%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl} " "${(e)PROMPT}"
assertEquals "%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl} " "${(e)PROMPT}"
}
function testRightPromptOnSameLine() {
@ -70,7 +70,7 @@ function testRightPromptOnSameLine() {
startSkipping
powerlevel9k_prepare_prompts
assertEquals "%{\e[1A%}%F{015}%f%K{015}%F{000} world1 %f%{\e[1B%}" "${(e)RPROMPT}"
assertEquals "%{\e[1A%}%F{007}%f%K{007}%F{000} world1 %f%{\e[1B%}" "${(e)RPROMPT}"
}
function testPrefixingFirstLineOnLeftPrompt() {
@ -84,7 +84,7 @@ function testPrefixingFirstLineOnLeftPrompt() {
powerlevel9k_prepare_prompts
local nl=$'\n'
assertEquals "XXX%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl} " "${(e)PROMPT}"
assertEquals "XXX%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl} " "${(e)PROMPT}"
}
function testPrefixingSecondLineOnLeftPrompt() {
@ -98,7 +98,7 @@ function testPrefixingSecondLineOnLeftPrompt() {
powerlevel9k_prepare_prompts
local nl=$'\n'
assertEquals "%f%b%k%K{015} %F{000}world1 %k%F{015}%f ${nl}XXX" "${(e)PROMPT}"
assertEquals "%f%b%k%K{007} %F{000}world1 %k%F{007}%f ${nl}XXX" "${(e)PROMPT}"
}
source shunit2/shunit2

View file

@ -18,7 +18,7 @@ function testOverwritingIconsWork() {
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
assertEquals "%K{015} %F{000}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}icon-here %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)"
}
function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {
@ -27,7 +27,7 @@ function testVisualIdentifierAppearsBeforeSegmentContentOnLeftSegments() {
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
assertEquals "%K{015} %F{000}icon-here %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}icon-here %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)"
}
function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {
@ -36,7 +36,7 @@ function testVisualIdentifierAppearsAfterSegmentContentOnRightSegments() {
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
local POWERLEVEL9K_CUSTOM_WORLD1_ICON='icon-here'
assertEquals "%F{015}%f%K{015}%F{000} world1%F{000} icon-here%f%E" "$(build_right_prompt)"
assertEquals "%F{007}%f%K{007}%F{000} world1%F{000} icon-here%f%E" "$(build_right_prompt)"
}
function testVisualIdentifierPrintsNothingIfNotAvailable() {
@ -44,7 +44,7 @@ function testVisualIdentifierPrintsNothingIfNotAvailable() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1)
local POWERLEVEL9K_CUSTOM_WORLD1='echo world1'
assertEquals "%K{015} %F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{000}world1 %k%F{007}%f " "$(build_left_prompt)"
}
function testVisualIdentifierIsPrintedInNumericalColorCode() {
@ -54,7 +54,7 @@ function testVisualIdentifierIsPrintedInNumericalColorCode() {
local POWERLEVEL9K_CUSTOM_WORLD1_ICON="xxx"
local POWERLEVEL9K_CUSTOM_WORLD1_VISUAL_IDENTIFIER_COLOR="purple3"
assertEquals "%K{015} %F{056}xxx %f%F{000}world1 %k%F{015}%f " "$(build_left_prompt)"
assertEquals "%K{007} %F{056}xxx %f%F{000}world1 %k%F{007}%f " "$(build_left_prompt)"
}
source shunit2/shunit2