aboutsummaryrefslogtreecommitdiff
path: root/test/segments/context.spec
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-07-19 23:39:19 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-07-19 23:39:19 +0300
commit16e5e14af747bb310dabd367648b5566cd2edc6b (patch)
tree9593ab0319da9f99bbc5dd29d437b092a806bfb7 /test/segments/context.spec
parent4b32b2c0b246e65529e8e055c63be8d58be15f95 (diff)
Fix tests on older ZSH versions
Diffstat (limited to 'test/segments/context.spec')
-rwxr-xr-xtest/segments/context.spec21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/segments/context.spec b/test/segments/context.spec
index e86bc357..702280df 100755
--- a/test/segments/context.spec
+++ b/test/segments/context.spec
@@ -23,41 +23,47 @@ function tearDown() {
function testContextSegmentDoesNotGetRenderedWithDefaultUser() {
local DEFAULT_USER=$(whoami)
local POWERLEVEL9K_CUSTOM_WORLD='echo world'
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context custom_world)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
}
function testContextSegmentDoesGetRenderedWhenSshConnectionIsOpen() {
local SSH_CLIENT="putty"
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
}
function testContextSegmentWithForeignUser() {
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
}
# TODO: How to test root?
function testContextSegmentWithRootUser() {
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
startSkipping # Skip test
assertEquals "%K{black} %F{yellow}%n@%m %k%F{black}%f " "$(build_left_prompt)"
}
function testOverridingContextTemplate() {
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
local POWERLEVEL9K_CONTEXT_TEMPLATE=xx
assertEquals "%K{black} %F{yellow}xx %k%F{black}%f " "$(build_left_prompt)"
}
function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
local POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true
local DEFAULT_USER=$(whoami)
@@ -65,7 +71,8 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() {
}
function testContextSegmentIsShownIfForced() {
- local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context)
local POWERLEVEL9K_ALWAYS_SHOW_USER=true
local DEFAULT_USER=$(whoami)