diff options
author | Miroslav Šedivý <6774676+eumiro@users.noreply.github.com> | 2017-08-11 23:44:18 +0300 |
---|---|---|
committer | Miroslav Šedivý <6774676+eumiro@users.noreply.github.com> | 2017-08-11 23:44:18 +0300 |
commit | 73a9ee7c870fcc93182c17f7d9d0c6942116169d (patch) | |
tree | c87480ece590a3302f142e2ce52397eb8e9d9c67 /test | |
parent | 50ecdfd57a7f88ff4e30a4dcc637ee83e3819006 (diff) |
add TRUNCATE_TO_UNIQUE shortening dir strategy
This creates the shortest unique path elements that can be unambiguously expanded to the original path.
Diffstat (limited to 'test')
-rwxr-xr-x | test/segments/dir.spec | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/segments/dir.spec b/test/segments/dir.spec index 3a6af649..dea54750 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -381,4 +381,25 @@ function testOmittingFirstCharacterWorksWithChangingPathSeparatorAndRightTruncat unset POWERLEVEL9K_SHORTEN_STRATEGY } +function testTruncateToUniqueWorks() { + POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true + POWERLEVEL9K_DIR_PATH_SEPARATOR='xXx' + POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + POWERLEVEL9K_SHORTEN_STRATEGY='truncate_to_unique' + mkdir -p /tmp/powerlevel9k-test/adam/devl + mkdir -p /tmp/powerlevel9k-test/alice/devl + mkdir -p /tmp/powerlevel9k-test/alice/docs + mkdir -p /tmp/powerlevel9k-test/bob/docs + cd /tmp/powerlevel9k-test/alice/devl + + assertEquals "%K{blue} %F{black}txXxpxXxalxXxde %k%F{blue}%f " "$(build_left_prompt)" + + cd - + 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 +} + source shunit2/source/2.1/src/shunit2 |