diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2017-02-14 04:18:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-14 04:18:44 +0300 |
commit | 221030013e93e6fcde44b8a6c656db9139c142c9 (patch) | |
tree | 39fd2ef32ad7dc45e0868356f1341f5a1269d037 /test | |
parent | 1de14df11fb3bf67958555b921f8323cda0d3d03 (diff) | |
parent | 6e1259ee99a51a8cb52f975ebb45ede2792a4730 (diff) |
Merge pull request #398 from dritter/benoits_dir_segment
Add "truncate_with_folder_marker" shorten strategy
Diffstat (limited to 'test')
-rwxr-xr-x | test/segments/dir.spec | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/segments/dir.spec b/test/segments/dir.spec index 840a298b..69359e25 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -71,6 +71,48 @@ function testTruncationFromRightWorks() { unset POWERLEVEL9K_SHORTEN_STRATEGY } +function testTruncateWithFolderMarkerWorks() { + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + 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_LEFT_PROMPT_ELEMENTS +} + +function testTruncateWithFolderMarkerWithChangedFolderMarker() { + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + 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_LEFT_PROMPT_ELEMENTS +} + function testHomeFolderDetectionWorks() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) POWERLEVEL9K_HOME_ICON='home-icon' |