mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-20 22:31:57 +00:00
Fix tests
This commit is contained in:
parent
27fe2c6571
commit
ef5f9bb1b4
8 changed files with 25 additions and 25 deletions
|
@ -65,7 +65,7 @@ function testDynamicColoringOfVisualIdentifiersWork() {
|
||||||
|
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
|
||||||
assertEquals "%K{012} %F{green%}icon-here %f%F{000}/tmp %k%F{012}%f " "$(build_left_prompt)"
|
assertEquals "%K{012} %F{002}icon-here %f%F{000}/tmp %k%F{012}%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{011} %F{green%}icon-here %f%F{009}/tmp %k%F{011}%f " "$(build_left_prompt)"
|
assertEquals "%K{011} %F{002}icon-here %f%F{009}/tmp %k%F{011}%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{012} %F{000%}icon-here %f%F{000}/tmp %k%F{012}%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_LEFT_PROMPT_ELEMENTS
|
||||||
unset POWERLEVEL9K_DIR_FOLDER_ICON
|
unset POWERLEVEL9K_DIR_FOLDER_ICON
|
||||||
|
|
|
@ -28,7 +28,7 @@ function testCommandExecutionTimeThresholdCouldBeChanged() {
|
||||||
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
|
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
|
||||||
_P9K_COMMAND_DURATION=2.03
|
_P9K_COMMAND_DURATION=2.03
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}2.03 %k%F{009}%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 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unset _P9K_COMMAND_DURATION
|
unset _P9K_COMMAND_DURATION
|
||||||
|
@ -40,7 +40,7 @@ function testCommandExecutionTimeThresholdCouldBeSetToZero() {
|
||||||
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
|
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
|
||||||
_P9K_COMMAND_DURATION=0.03
|
_P9K_COMMAND_DURATION=0.03
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.03 %k%F{009}%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 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unset _P9K_COMMAND_DURATION
|
unset _P9K_COMMAND_DURATION
|
||||||
|
@ -53,7 +53,7 @@ function testCommandExecutionTimePrecisionCouldBeChanged() {
|
||||||
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4
|
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=4
|
||||||
_P9K_COMMAND_DURATION=0.0001
|
_P9K_COMMAND_DURATION=0.0001
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}0.0001 %k%F{009}%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 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unset _P9K_COMMAND_DURATION
|
unset _P9K_COMMAND_DURATION
|
||||||
|
@ -66,7 +66,7 @@ function testCommandExecutionTimePrecisionCouldBeSetToZero() {
|
||||||
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
||||||
_P9K_COMMAND_DURATION=23.5001
|
_P9K_COMMAND_DURATION=23.5001
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}23 %k%F{009}%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 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unset _P9K_COMMAND_DURATION
|
unset _P9K_COMMAND_DURATION
|
||||||
|
@ -77,7 +77,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForMinuteLongCommand()
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||||
_P9K_COMMAND_DURATION=180
|
_P9K_COMMAND_DURATION=180
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}03:00 %k%F{009}%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 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unset _P9K_COMMAND_DURATION
|
unset _P9K_COMMAND_DURATION
|
||||||
|
@ -87,7 +87,7 @@ function testCommandExecutionTimeIsFormattedHumandReadbleForHourLongCommand() {
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(command_execution_time)
|
||||||
_P9K_COMMAND_DURATION=7200
|
_P9K_COMMAND_DURATION=7200
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}Dur %f%F{226}02:00:00 %k%F{009}%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 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unset _P9K_COMMAND_DURATION
|
unset _P9K_COMMAND_DURATION
|
||||||
|
|
|
@ -329,7 +329,7 @@ function testHomeFolderDetectionWorks() {
|
||||||
POWERLEVEL9K_HOME_ICON='home-icon'
|
POWERLEVEL9K_HOME_ICON='home-icon'
|
||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
assertEquals "%K{012} %F{000%}home-icon %f%F{000}~ %k%F{012}%f " "$(build_left_prompt)"
|
assertEquals "%K{012} %F{000}home-icon %f%F{000}~ %k%F{012}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
unset POWERLEVEL9K_HOME_ICON
|
unset POWERLEVEL9K_HOME_ICON
|
||||||
|
@ -341,7 +341,7 @@ function testHomeSubfolderDetectionWorks() {
|
||||||
FOLDER=~/powerlevel9k-test
|
FOLDER=~/powerlevel9k-test
|
||||||
mkdir $FOLDER
|
mkdir $FOLDER
|
||||||
cd $FOLDER
|
cd $FOLDER
|
||||||
assertEquals "%K{012} %F{000%}sub-icon %f%F{000}~/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
assertEquals "%K{012} %F{000}sub-icon %f%F{000}~/powerlevel9k-test %k%F{012}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
rm -fr $FOLDER
|
rm -fr $FOLDER
|
||||||
|
@ -355,7 +355,7 @@ function testOtherFolderDetectionWorks() {
|
||||||
FOLDER=/tmp/powerlevel9k-test
|
FOLDER=/tmp/powerlevel9k-test
|
||||||
mkdir $FOLDER
|
mkdir $FOLDER
|
||||||
cd $FOLDER
|
cd $FOLDER
|
||||||
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}/tmp/powerlevel9k-test %k%F{012}%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 -
|
cd -
|
||||||
rm -fr $FOLDER
|
rm -fr $FOLDER
|
||||||
|
@ -407,7 +407,7 @@ function testOmittingFirstCharacterWorks() {
|
||||||
POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
|
||||||
assertEquals "%K{012} %F{000%}folder-icon %f%F{000}tmp %k%F{012}%f " "$(build_left_prompt)"
|
assertEquals "%K{012} %F{000}folder-icon %f%F{000}tmp %k%F{012}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
unset POWERLEVEL9K_FOLDER_ICON
|
unset POWERLEVEL9K_FOLDER_ICON
|
||||||
|
@ -421,7 +421,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{012} %F{000%}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
assertEquals "%K{012} %F{000}folder-icon %f%F{000}tmpxXxpowerlevel9k-testxXx1xXx2 %k%F{012}%f " "$(build_left_prompt)"
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
rm -fr /tmp/powerlevel9k-test
|
rm -fr /tmp/powerlevel9k-test
|
||||||
|
|
|
@ -40,7 +40,7 @@ function testGo() {
|
||||||
|
|
||||||
PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
|
PWD="$HOME/go/src/github.com/bhilburn/powerlevel9k"
|
||||||
|
|
||||||
assertEquals "%K{002} %F{255%} %f%F{255}go1.5.3 %k%F{002}%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 POWERLEVEL9K_GO_ICON
|
||||||
unset PWD
|
unset PWD
|
||||||
|
|
|
@ -69,7 +69,7 @@ function testKubeContext() {
|
||||||
alias kubectl=mockKubectl
|
alias kubectl=mockKubectl
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
||||||
|
|
||||||
assertEquals "%K{013} %F{015%}⎈ %f%F{015}minikube/default %k%F{013}%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
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unalias kubectl
|
unalias kubectl
|
||||||
|
@ -78,7 +78,7 @@ function testKubeContextOtherNamespace() {
|
||||||
alias kubectl=mockKubectlOtherNamespace
|
alias kubectl=mockKubectlOtherNamespace
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(kubecontext)
|
||||||
|
|
||||||
assertEquals "%K{013} %F{015%}⎈ %f%F{015}minikube/kube-system %k%F{013}%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
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
unalias kubectl
|
unalias kubectl
|
||||||
|
|
|
@ -31,7 +31,7 @@ function testLaravelVersionSegment() {
|
||||||
POWERLEVEL9K_LARAVEL_ICON='x'
|
POWERLEVEL9K_LARAVEL_ICON='x'
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(laravel_version)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(laravel_version)
|
||||||
|
|
||||||
assertEquals "%K{001} %F{015%}x %f%F{015}5.4.23 %k%F{001}%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_LEFT_PROMPT_ELEMENTS
|
||||||
unset POWERLEVEL9K_LARAVEL_ICON
|
unset POWERLEVEL9K_LARAVEL_ICON
|
||||||
|
|
|
@ -32,7 +32,7 @@ function testRust() {
|
||||||
mockRust
|
mockRust
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
|
||||||
|
|
||||||
assertEquals "%K{208} %F{000%}Rust %f%F{000}0.4.1a-alpha %k%F{208}%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
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ function testStatusWorksAsExpectedIfReturnCodeIsZeroAndVerboseIsSet() {
|
||||||
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true
|
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=true
|
||||||
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status)
|
||||||
|
|
||||||
assertEquals "%K{000} %F{002%}✔%f %k%F{000}%f " "$(build_left_prompt)"
|
assertEquals "%K{000} %F{002}✔%f %k%F{000}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusInGeneralErrorCase() {
|
function testStatusInGeneralErrorCase() {
|
||||||
|
@ -40,7 +40,7 @@ function testStatusInGeneralErrorCase() {
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=false
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}↵ %f%F{226}1 %k%F{009}%f " "$(build_left_prompt)"
|
assertEquals "%K{009} %F{226}↵ %f%F{226}1 %k%F{009}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPipestatusInErrorCase() {
|
function testPipestatusInErrorCase() {
|
||||||
|
@ -50,7 +50,7 @@ function testPipestatusInErrorCase() {
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
|
local POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}↵ %f%F{226}0|0|1|0 %k%F{009}%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() {
|
function testStatusCrossWinsOverVerbose() {
|
||||||
|
@ -60,7 +60,7 @@ function testStatusCrossWinsOverVerbose() {
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_CROSS=true
|
local POWERLEVEL9K_STATUS_CROSS=true
|
||||||
|
|
||||||
assertEquals "%K{000} %F{009%}✘%f %k%F{000}%f " "$(build_left_prompt)"
|
assertEquals "%K{000} %F{009}✘%f %k%F{000}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusShowsSignalNameInErrorCase() {
|
function testStatusShowsSignalNameInErrorCase() {
|
||||||
|
@ -70,7 +70,7 @@ function testStatusShowsSignalNameInErrorCase() {
|
||||||
local POWERLEVEL9K_STATUS_VERBOSE=true
|
local POWERLEVEL9K_STATUS_VERBOSE=true
|
||||||
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
|
local POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
|
||||||
|
|
||||||
assertEquals "%K{009} %F{226%}↵ %f%F{226}SIGILL(4) %k%F{009}%f " "$(build_left_prompt)"
|
assertEquals "%K{009} %F{226}↵ %f%F{226}SIGILL(4) %k%F{009}%f " "$(build_left_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function testStatusSegmentIntegrated() {
|
function testStatusSegmentIntegrated() {
|
||||||
|
@ -79,7 +79,7 @@ function testStatusSegmentIntegrated() {
|
||||||
|
|
||||||
false; powerlevel9k_prepare_prompts
|
false; powerlevel9k_prepare_prompts
|
||||||
|
|
||||||
assertEquals "%f%b%k%K{000} %F{009%}✘%f %k%F{000}%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
|
source shunit2/source/2.1/src/shunit2
|
Loading…
Reference in a new issue