diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-10-07 08:45:02 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-10-12 23:04:02 +0300 |
commit | d831f12126374b0d1ba2207e24fa9749e795779f (patch) | |
tree | 89d0b3dd7099fb110f6d77f64f7824131ff39935 /test | |
parent | d1cd83bf0bd150c72e86de2f7b34e86f7865286d (diff) |
Do not throw away users configuration
Diffstat (limited to 'test')
-rwxr-xr-x | test/segments/context.spec | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/test/segments/context.spec b/test/segments/context.spec index 4dec526a..25c355a7 100755 --- a/test/segments/context.spec +++ b/test/segments/context.spec @@ -11,21 +11,34 @@ function setUp() { # Test specific settings OLD_DEFAULT_USER=$DEFAULT_USER unset DEFAULT_USER + + # Fix leaked state for travis + OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW=$POWERLEVEL9K_CONTEXT_ALWAYS_SHOW + unset POWERLEVEL9K_CONTEXT_ALWAYS_SHOW + OLD_SSH_CLIENT=$SSH_CLIENT + unset SSH_CLIENT + OLD_SSH_TTY=$SSH_TTY + unset SSH_TTY } function tearDown() { # Restore old variables [[ -n "$OLD_DEFAULT_USER" ]] && DEFAULT_USER=$OLD_DEFAULT_USER + unset OLD_DEFAULT_USER + + [[ -n "$OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW" ]] && POWERLEVEL9K_CONTEXT_ALWAYS_SHOW=$OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW + unset OLD_POWERLEVEL9K_CONTEXT_ALWAYS_SHOW + + [[ -n "$OLD_SSH_CLIENT" ]] && SSH_CLIENT=$OLD_SSH_CLIENT + unset OLD_SSH_CLIENT + + [[ -n "$OLD_SSH_TTY" ]] && SSH_TTY=$OLD_SSH_TTY + unset OLD_SSH_TTY return 0 } function testContextSegmentDoesNotGetRenderedWithDefaultUser() { - # Fix leaked state for travis - unset POWERLEVEL9K_CONTEXT_ALWAYS_SHOW - unset SSH_CLIENT - unset SSH_TTY - local DEFAULT_USER=$(whoami) local POWERLEVEL9K_CUSTOM_WORLD='echo world' local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS @@ -104,11 +117,6 @@ function testContextSegmentIsShownIfDefaultUserIsSetWhenForced() { } function testContextSegmentIsShownIfForced() { - # Fix leaked state for travis - unset POWERLEVEL9K_CONTEXT_ALWAYS_SHOW - unset SSH_CLIENT - unset SSH_TTY - local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context) local POWERLEVEL9K_ALWAYS_SHOW_USER=true |