diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-07-19 23:39:19 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-07-19 23:39:19 +0300 |
commit | 16e5e14af747bb310dabd367648b5566cd2edc6b (patch) | |
tree | 9593ab0319da9f99bbc5dd29d437b092a806bfb7 /test/segments/ip.spec | |
parent | 4b32b2c0b246e65529e8e055c63be8d58be15f95 (diff) |
Fix tests on older ZSH versions
Diffstat (limited to 'test/segments/ip.spec')
-rwxr-xr-x | test/segments/ip.spec | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/test/segments/ip.spec b/test/segments/ip.spec index 3ae2d389..0d07b6ee 100755 --- a/test/segments/ip.spec +++ b/test/segments/ip.spec @@ -12,8 +12,9 @@ function setUp() { } function testIpSegmentPrintsNothingOnOsxIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) alias networksetup='echo "not connected"' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) local OS="OSX" # Fake OSX local POWERLEVEL9K_CUSTOM_WORLD='echo world' @@ -23,8 +24,9 @@ function testIpSegmentPrintsNothingOnOsxIfNotConnected() { } function testIpSegmentPrintsNothingOnLinuxIfNotConnected() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) alias ip='echo "not connected"' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip custom_world) local OS="Linux" # Fake Linux local POWERLEVEL9K_CUSTOM_WORLD='echo world' @@ -34,7 +36,8 @@ function testIpSegmentPrintsNothingOnLinuxIfNotConnected() { } function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='OSX' # Fake OSX alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled. (1) Ethernet @@ -69,7 +72,8 @@ function testIpSegmentWorksOnOsxWithNoInterfaceSpecified() { # in hierarchical order, but from outside this is not obvious # (implementation detail). So we need a test for this case. function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='OSX' # Fake OSX alias networksetup="echo 'An asterisk (*) denotes that a network service is disabled. (1) Ethernet @@ -116,7 +120,8 @@ function testIpSegmentWorksOnOsxWithMultipleInterfacesSpecified() { } function testIpSegmentWorksOnOsxWithInterfaceSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='OSX' # Fake OSX local POWERLEVEL9K_IP_INTERFACE='xxx' alias ipconfig="_(){ echo '1.2.3.4'; };_" @@ -155,7 +160,8 @@ function testIpSegmentWorksOnLinuxWithNoInterfaceSpecified() { function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() { setopt aliases - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='Linux' # Fake Linux # That command is harder to test, as it is used at first # to get all relevant network interfaces and then for @@ -185,7 +191,8 @@ function testIpSegmentWorksOnLinuxWithMultipleInterfacesSpecified() { } function testIpSegmentWorksOnLinuxWithInterfaceSpecified() { - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ip) local OS='Linux' # Fake Linux local POWERLEVEL9K_IP_INTERFACE='xxx' ip(){ |