From 16e5e14af747bb310dabd367648b5566cd2edc6b Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 19 Jul 2018 22:39:19 +0200 Subject: Fix tests on older ZSH versions --- test/segments/context.spec | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'test/segments/context.spec') 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) -- cgit v1.2.3