mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 13:41:56 +00:00
Do not throw away users configuration
This commit is contained in:
parent
d1cd83bf0b
commit
d831f12126
1 changed files with 18 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue