mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 21:41:57 +00:00
Add test for truncate_with_folder_marker truncation strategy
This commit is contained in:
parent
ed9d18f1de
commit
8e99944797
1 changed files with 46 additions and 0 deletions
|
@ -71,6 +71,52 @@ function testTruncationFromRightWorks() {
|
|||
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
||||
}
|
||||
|
||||
function testTruncateWithFolderMarkerWorks() {
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
||||
|
||||
local BASEFOLDER=/tmp/powerlevel9k-test
|
||||
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
||||
mkdir -p $FOLDER
|
||||
# Setup folder marker
|
||||
touch $BASEFOLDER/1/12/.shorten_folder_marker
|
||||
cd $FOLDER
|
||||
assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr $BASEFOLDER
|
||||
unset BASEFOLDER
|
||||
unset FOLDER
|
||||
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
||||
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
}
|
||||
|
||||
function testTruncateWithFolderMarkerWithChangedFolderMarker() {
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
||||
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
||||
POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx'
|
||||
|
||||
local BASEFOLDER=/tmp/powerlevel9k-test
|
||||
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
||||
mkdir -p $FOLDER
|
||||
# Setup folder marker
|
||||
touch $BASEFOLDER/1/12/.xxx
|
||||
cd $FOLDER
|
||||
assertEquals "%K{blue} %F{black}/…/12/123/1234/12345/123456/1234567 %k%F{blue}%f " "$(build_left_prompt)"
|
||||
|
||||
cd -
|
||||
rm -fr $BASEFOLDER
|
||||
unset BASEFOLDER
|
||||
unset FOLDER
|
||||
unset POWERLEVEL9K_SHORTEN_FOLDER_MARKER
|
||||
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
||||
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
||||
}
|
||||
|
||||
function testHomeFolderDetectionWorks() {
|
||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
||||
POWERLEVEL9K_HOME_ICON='home-icon'
|
||||
|
|
Loading…
Reference in a new issue