mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 13:41:56 +00:00
Add test for wrong truncation if switching back to home folder
This happens if a user switches from a subdirectory of $HOME back to the home folder and truncation strategy is "truncate folders from left". Then the folder is displayed as .../~ PR: #773
This commit is contained in:
parent
a761e3c28a
commit
83ad5b598e
1 changed files with 21 additions and 0 deletions
|
@ -36,6 +36,27 @@ function testTruncateFoldersWorks() {
|
|||
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
||||
}
|
||||
|
||||
function testTruncateFolderWithHomeDirWorks() {
|
||||
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
cd ~
|
||||
FOLDER="powerlevel9k-test-${RANDOM}"
|
||||
mkdir -p $FOLDER
|
||||
cd $FOLDER
|
||||
# Switch back to home folder as this causes the problem.
|
||||
cd ..
|
||||
|
||||
assertEquals "%K{blue} %F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
rmdir $FOLDER
|
||||
cd ${CURRENT_DIR}
|
||||
|
||||
unset CURRENT_DIR
|
||||
unset FOLDER
|
||||
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||
}
|
||||
|
||||
function testTruncateMiddleWorks() {
|
||||
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
||||
|
|
Loading…
Reference in a new issue