mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2025-12-11 22:02:32 +01:00
Improve tests by making use of local variables
This commit is contained in:
parent
822b820a6e
commit
4972f0b8eb
8 changed files with 207 additions and 281 deletions
|
|
@ -29,22 +29,19 @@ function mockRust() {
|
|||
}
|
||||
|
||||
function testRust() {
|
||||
mockRust
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
|
||||
mockRust
|
||||
|
||||
assertEquals "%K{208} %F{black%}Rust %f%F{black}0.4.1a-alpha %k%F{darkorange}%f " "$(build_left_prompt)"
|
||||
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
}
|
||||
|
||||
function testRustPrintsNothingIfRustIsNotAvailable() {
|
||||
POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world rust_version)
|
||||
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
|
||||
|
||||
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
|
||||
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
unset POWERLEVEL9K_CUSTOM_WORLD
|
||||
}
|
||||
|
||||
source shunit2/source/2.1/src/shunit2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue