aboutsummaryrefslogtreecommitdiff
path: root/test/segments
diff options
context:
space:
mode:
authorChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-23 08:28:56 +0300
committerChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-23 08:28:56 +0300
commit08432bf70c1874ab4f67538f85e7be50847f1c5d (patch)
tree72b245dadfc4941ff06d0e39e7c7d42424d51655 /test/segments
parent01f7261df4fdabbe815055c5a42853dc48f07da0 (diff)
Added truncate_to_first_and_last strategy
Truncate middle directories from the path. How many directories will be untouched is controlled by POWERLEVEL9K_SHORTER_DIR_LENGTH.
Diffstat (limited to 'test/segments')
-rwxr-xr-xtest/segments/dir.spec18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/segments/dir.spec b/test/segments/dir.spec
index 8c9554d7..3e7f11d4 100755
--- a/test/segments/dir.spec
+++ b/test/segments/dir.spec
@@ -90,6 +90,24 @@ function testTruncateToLastWorks() {
unset POWERLEVEL9K_SHORTEN_STRATEGY
}
+function testTruncateToFirstAndLastWorks() {
+ POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
+ POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_first_and_last"
+
+ FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
+ mkdir -p $FOLDER
+ cd $FOLDER
+
+ assertEquals "%K{blue} %F{black}/tmp/12/…/12345678/123456789 %k%F{blue}%f " "$(build_left_prompt)"
+
+ cd -
+ rm -fr /tmp/powerlevel9k-test
+
+ unset FOLDER
+ unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
+ unset POWERLEVEL9K_SHORTEN_STRATEGY
+}
+
function testTruncateAbsoluteWorks() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_absolute"