Improve tests by making use of local variables

This commit is contained in:
Dominik Ritter 2018-07-24 16:24:33 +02:00
commit 4972f0b8eb
8 changed files with 207 additions and 281 deletions

View file

@ -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