Merge pull request #1151 from Wuestengecko/bugfix-1150

[Bugfix] Only abbreviate $HOME at the beginning of cwd
This commit is contained in:
Dominik Ritter 2019-02-02 00:48:54 +01:00 committed by GitHub
commit 22f6495005
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -768,4 +768,22 @@ function testDirSeparatorColorRootSubSubdirWorks() {
rm -fr /tmp/powerlevel9k-test
}
function testDirHomeTruncationWorksOnlyAtTheBeginning() {
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
local FOLDER=/tmp/p9ktest
local SAVED_HOME="${HOME}"
HOME="/p9ktest"
mkdir -p $FOLDER
# Setup folder marker
cd $FOLDER
assertEquals "%K{004} %F{000}/tmp/p9ktest %k%F{004}%f " "$(build_left_prompt)"
cd -
rm -fr $FOLDER
HOME="${SAVED_HOME}"
}
source shunit2/shunit2