|
|
@ -9,17 +9,12 @@ function setUp() {
|
|
|
|
export TERM="xterm-256color"
|
|
|
|
export TERM="xterm-256color"
|
|
|
|
# Load Powerlevel9k
|
|
|
|
# Load Powerlevel9k
|
|
|
|
source powerlevel9k.zsh-theme
|
|
|
|
source powerlevel9k.zsh-theme
|
|
|
|
|
|
|
|
|
|
|
|
# Every test should at least use the dir segment
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function tearDown() {
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testDirPathAbsoluteWorks() {
|
|
|
|
function testDirPathAbsoluteWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_ABSOLUTE=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_ABSOLUTE=true
|
|
|
|
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
|
|
|
@ -33,14 +28,15 @@ function testDirPathAbsoluteWorks() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_ABSOLUTE
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateFoldersWorks() {
|
|
|
|
function testTruncateFoldersWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -48,18 +44,16 @@ function testTruncateFoldersWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateFolderWithHomeDirWorks() {
|
|
|
|
function testTruncateFolderWithHomeDirWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
CURRENT_DIR=$(pwd)
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
|
|
|
|
|
|
|
local CURRENT_DIR=$(pwd)
|
|
|
|
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
cd ~
|
|
|
|
FOLDER="powerlevel9k-test-${RANDOM}"
|
|
|
|
local FOLDER="powerlevel9k-test-${RANDOM}"
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
# Switch back to home folder as this causes the problem.
|
|
|
|
# Switch back to home folder as this causes the problem.
|
|
|
@ -69,17 +63,15 @@ function testTruncateFolderWithHomeDirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
rmdir $FOLDER
|
|
|
|
rmdir $FOLDER
|
|
|
|
cd ${CURRENT_DIR}
|
|
|
|
cd ${CURRENT_DIR}
|
|
|
|
|
|
|
|
|
|
|
|
unset CURRENT_DIR
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateMiddleWorks() {
|
|
|
|
function testTruncateMiddleWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -87,17 +79,15 @@ function testTruncateMiddleWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncationFromRightWorks() {
|
|
|
|
function testTruncationFromRightWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -105,17 +95,15 @@ function testTruncationFromRightWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateToLastWorks() {
|
|
|
|
function testTruncateToLastWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_last"
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_last"
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -123,17 +111,15 @@ function testTruncateToLastWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateToFirstAndLastWorks() {
|
|
|
|
function testTruncateToFirstAndLastWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_first_and_last"
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_first_and_last"
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -141,17 +127,15 @@ function testTruncateToFirstAndLastWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateAbsoluteWorks() {
|
|
|
|
function testTruncateAbsoluteWorks() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_absolute"
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_absolute"
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -159,18 +143,16 @@ function testTruncateAbsoluteWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncationFromRightWithEmptyDelimiter() {
|
|
|
|
function testTruncationFromRightWithEmptyDelimiter() {
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_SHORTEN_DELIMITER=""
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DELIMITER=""
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
|
|
|
|
|
|
|
@ -178,16 +160,12 @@ function testTruncationFromRightWithEmptyDelimiter() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DELIMITER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateWithFolderMarkerWorks() {
|
|
|
|
function testTruncateWithFolderMarkerWorks() {
|
|
|
|
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
|
|
|
|
|
|
|
|
|
|
|
local BASEFOLDER=/tmp/powerlevel9k-test
|
|
|
|
local BASEFOLDER=/tmp/powerlevel9k-test
|
|
|
|
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
|
|
|
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
|
|
@ -199,16 +177,13 @@ function testTruncateWithFolderMarkerWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
unset BASEFOLDER
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateWithFolderMarkerWithChangedFolderMarker() {
|
|
|
|
function testTruncateWithFolderMarkerWithChangedFolderMarker() {
|
|
|
|
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
|
|
|
|
POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx'
|
|
|
|
local POWERLEVEL9K_SHORTEN_FOLDER_MARKER='.xxx'
|
|
|
|
|
|
|
|
|
|
|
|
local BASEFOLDER=/tmp/powerlevel9k-test
|
|
|
|
local BASEFOLDER=/tmp/powerlevel9k-test
|
|
|
|
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
|
|
|
local FOLDER=$BASEFOLDER/1/12/123/1234/12345/123456/1234567
|
|
|
@ -220,11 +195,6 @@ function testTruncateWithFolderMarkerWithChangedFolderMarker() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
unset BASEFOLDER
|
|
|
|
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_FOLDER_MARKER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateWithPackageNameWorks() {
|
|
|
|
function testTruncateWithPackageNameWorks() {
|
|
|
@ -245,18 +215,16 @@ function testTruncateWithPackageNameWorks() {
|
|
|
|
# Go back to deeper folder
|
|
|
|
# Go back to deeper folder
|
|
|
|
cd "${FOLDER}"
|
|
|
|
cd "${FOLDER}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}My_Package/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
# Go back
|
|
|
|
# Go back
|
|
|
|
cd $p9kFolder
|
|
|
|
cd $p9kFolder
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
|
|
|
|
function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
|
|
|
@ -284,18 +252,16 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideDeepFolder() {
|
|
|
|
# Go to deep folder inside linked repo
|
|
|
|
# Go to deep folder inside linked repo
|
|
|
|
cd linked-repo/asdfasdf/qwerqwer
|
|
|
|
cd linked-repo/asdfasdf/qwerqwer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}My_Package/as…/qwerqwer %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}My_Package/as…/qwerqwer %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
# Go back
|
|
|
|
# Go back
|
|
|
|
cd $p9kFolder
|
|
|
|
cd $p9kFolder
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
|
|
|
|
function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
|
|
|
@ -319,60 +285,61 @@ function testTruncateWithPackageNameIfRepoIsSymlinkedInsideGitDir() {
|
|
|
|
|
|
|
|
|
|
|
|
cd linked-repo/.git/refs/heads
|
|
|
|
cd linked-repo/.git/refs/heads
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_with_package_name'
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}My_Package/.g…/re…/heads %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}My_Package/.g…/re…/heads %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
# Go back
|
|
|
|
# Go back
|
|
|
|
cd $p9kFolder
|
|
|
|
cd $p9kFolder
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
rm -fr $BASEFOLDER
|
|
|
|
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHomeFolderDetectionWorks() {
|
|
|
|
function testHomeFolderDetectionWorks() {
|
|
|
|
POWERLEVEL9K_HOME_ICON='home-icon'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_HOME_ICON='home-icon'
|
|
|
|
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
cd ~
|
|
|
|
assertEquals "%K{blue} %F{black%}home-icon %f%F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black%}home-icon %f%F{black}~ %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_HOME_ICON
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHomeSubfolderDetectionWorks() {
|
|
|
|
function testHomeSubfolderDetectionWorks() {
|
|
|
|
POWERLEVEL9K_HOME_SUB_ICON='sub-icon'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_HOME_SUB_ICON='sub-icon'
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=~/powerlevel9k-test
|
|
|
|
local FOLDER=~/powerlevel9k-test
|
|
|
|
mkdir $FOLDER
|
|
|
|
mkdir $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
assertEquals "%K{blue} %F{black%}sub-icon %f%F{black}~/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black%}sub-icon %f%F{black}~/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr $FOLDER
|
|
|
|
rm -fr $FOLDER
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_HOME_SUB_ICON
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testOtherFolderDetectionWorks() {
|
|
|
|
function testOtherFolderDetectionWorks() {
|
|
|
|
POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
|
|
|
|
|
|
|
|
|
|
|
FOLDER=/tmp/powerlevel9k-test
|
|
|
|
local FOLDER=/tmp/powerlevel9k-test
|
|
|
|
mkdir $FOLDER
|
|
|
|
mkdir $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}/tmp/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}/tmp/powerlevel9k-test %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr $FOLDER
|
|
|
|
rm -fr $FOLDER
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_FOLDER_ICON
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testChangingDirPathSeparator() {
|
|
|
|
function testChangingDirPathSeparator() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
local FOLDER="/tmp/powerlevel9k-test/1/2"
|
|
|
|
local FOLDER="/tmp/powerlevel9k-test/1/2"
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
mkdir -p $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
|
cd $FOLDER
|
|
|
@ -380,12 +347,12 @@ function testChangingDirPathSeparator() {
|
|
|
|
assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}xXxtmpxXxpowerlevel9k-testxXx1xXx2 %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset FOLDER
|
|
|
|
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHomeFolderAbbreviation() {
|
|
|
|
function testHomeFolderAbbreviation() {
|
|
|
|
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION
|
|
|
|
local POWERLEVEL9K_HOME_FOLDER_ABBREVIATION
|
|
|
|
local dir=$PWD
|
|
|
|
local dir=$PWD
|
|
|
|
|
|
|
|
|
|
|
@ -411,21 +378,23 @@ function testHomeFolderAbbreviation() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testOmittingFirstCharacterWorks() {
|
|
|
|
function testOmittingFirstCharacterWorks() {
|
|
|
|
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
|
|
|
|
local POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
|
|
|
cd /tmp
|
|
|
|
cd /tmp
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black%}folder-icon %f%F{black}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_FOLDER_ICON
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
|
|
|
|
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
|
|
|
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
|
|
|
|
local POWERLEVEL9K_FOLDER_ICON='folder-icon'
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
|
|
|
|
|
|
|
@ -433,9 +402,6 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_FOLDER_ICON
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# This test makes it obvious that combining a truncation strategy
|
|
|
|
# This test makes it obvious that combining a truncation strategy
|
|
|
@ -446,10 +412,12 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparator() {
|
|
|
|
# But it does more sense in combination with other truncation
|
|
|
|
# But it does more sense in combination with other truncation
|
|
|
|
# strategies.
|
|
|
|
# strategies.
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTruncation() {
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTruncation() {
|
|
|
|
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_folders'
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
|
|
|
|
|
|
|
@ -457,17 +425,15 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndDefaultTrunc
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTruncation() {
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTruncation() {
|
|
|
|
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_middle'
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
|
|
|
|
|
|
|
@ -475,17 +441,15 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndMiddleTrunca
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncation() {
|
|
|
|
function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncation() {
|
|
|
|
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
cd /tmp/powerlevel9k-test/1/2
|
|
|
|
|
|
|
|
|
|
|
@ -493,17 +457,15 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testTruncateToUniqueWorks() {
|
|
|
|
function testTruncateToUniqueWorks() {
|
|
|
|
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
local POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
|
|
|
|
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique'
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx'
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
|
|
|
|
|
|
|
|
local POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique'
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/adam/devl
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/adam/devl
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/alice/devl
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/alice/devl
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/alice/docs
|
|
|
|
mkdir -p /tmp/powerlevel9k-test/alice/docs
|
|
|
@ -514,24 +476,23 @@ function testTruncateToUniqueWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
|
|
|
|
|
|
|
unset POWERLEVEL9K_SHORTEN_STRATEGY
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBoldHomeDirWorks() {
|
|
|
|
function testBoldHomeDirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
cd ~
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}%B~%b %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}%B~%b %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBoldHomeSubdirWorks() {
|
|
|
|
function testBoldHomeSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
mkdir -p ~/powerlevel9k-test
|
|
|
|
mkdir -p ~/powerlevel9k-test
|
|
|
|
cd ~/powerlevel9k-test
|
|
|
|
cd ~/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
@ -539,31 +500,34 @@ function testBoldHomeSubdirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr ~/powerlevel9k-test
|
|
|
|
rm -fr ~/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBoldRootDirWorks() {
|
|
|
|
function testBoldRootDirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
cd /
|
|
|
|
cd /
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBoldRootSubdirWorks() {
|
|
|
|
function testBoldRootSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
cd /tmp
|
|
|
|
cd /tmp
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}/%Btmp%b %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}/%Btmp%b %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testBoldRootSubSubdirWorks() {
|
|
|
|
function testBoldRootSubSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true
|
|
|
|
mkdir -p /tmp/powerlevel9k-test
|
|
|
|
mkdir -p /tmp/powerlevel9k-test
|
|
|
|
cd /tmp/powerlevel9k-test
|
|
|
|
cd /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
@ -571,21 +535,23 @@ function testBoldRootSubSubdirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHighlightHomeWorks() {
|
|
|
|
function testHighlightHomeWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
cd ~
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}%F{red}~ %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}%F{red}~ %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHighlightHomeSubdirWorks() {
|
|
|
|
function testHighlightHomeSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
mkdir -p ~/powerlevel9k-test
|
|
|
|
mkdir -p ~/powerlevel9k-test
|
|
|
|
cd ~/powerlevel9k-test
|
|
|
|
cd ~/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
@ -593,31 +559,34 @@ function testHighlightHomeSubdirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr ~/powerlevel9k-test
|
|
|
|
rm -fr ~/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHighlightRootWorks() {
|
|
|
|
function testHighlightRootWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
cd /
|
|
|
|
cd /
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}%F{red}/ %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}%F{red}/ %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHighlightRootSubdirWorks() {
|
|
|
|
function testHighlightRootSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
cd /tmp
|
|
|
|
cd /tmp
|
|
|
|
|
|
|
|
|
|
|
|
assertEquals "%K{blue} %F{black}/%F{red}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
assertEquals "%K{blue} %F{black}/%F{red}tmp %k%F{blue}%f " "$(build_left_prompt)"
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testHighlightRootSubSubdirWorks() {
|
|
|
|
function testHighlightRootSubSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red'
|
|
|
|
mkdir /tmp/powerlevel9k-test
|
|
|
|
mkdir /tmp/powerlevel9k-test
|
|
|
|
cd /tmp/powerlevel9k-test
|
|
|
|
cd /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
@ -625,11 +594,12 @@ function testHighlightRootSubSubdirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testDirSeparatorColorHomeSubdirWorks() {
|
|
|
|
function testDirSeparatorColorHomeSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'
|
|
|
|
mkdir -p ~/powerlevel9k-test
|
|
|
|
mkdir -p ~/powerlevel9k-test
|
|
|
|
cd ~/powerlevel9k-test
|
|
|
|
cd ~/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
@ -637,11 +607,12 @@ function testDirSeparatorColorHomeSubdirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr ~/powerlevel9k-test
|
|
|
|
rm -fr ~/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function testDirSeparatorColorRootSubSubdirWorks() {
|
|
|
|
function testDirSeparatorColorRootSubSubdirWorks() {
|
|
|
|
POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'
|
|
|
|
local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
|
|
|
|
|
|
|
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
|
|
|
|
|
|
|
|
local POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='red'
|
|
|
|
mkdir -p /tmp/powerlevel9k-test
|
|
|
|
mkdir -p /tmp/powerlevel9k-test
|
|
|
|
cd /tmp/powerlevel9k-test
|
|
|
|
cd /tmp/powerlevel9k-test
|
|
|
|
|
|
|
|
|
|
|
@ -649,7 +620,6 @@ function testDirSeparatorColorRootSubSubdirWorks() {
|
|
|
|
|
|
|
|
|
|
|
|
cd -
|
|
|
|
cd -
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
rm -fr /tmp/powerlevel9k-test
|
|
|
|
unset POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
source shunit2/source/2.1/src/shunit2
|
|
|
|
source shunit2/source/2.1/src/shunit2
|
|
|
|