From 8bb86908d74097cda237115273acfdbaa5f39ea1 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Fri, 1 Feb 2019 23:48:39 +0100 Subject: [PATCH] Add tests --- test/segments/dir.spec | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/segments/dir.spec b/test/segments/dir.spec index 46e0cfb8..d75ca42f 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -768,4 +768,22 @@ function testDirSeparatorColorRootSubSubdirWorks() { rm -fr /tmp/powerlevel9k-test } +function testDirHomeTruncationWorksOnlyAtTheBeginning() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) + + local FOLDER=/tmp/p9ktest + local SAVED_HOME="${HOME}" + HOME="/p9ktest" + + mkdir -p $FOLDER + # Setup folder marker + cd $FOLDER + assertEquals "%K{004} %F{000}/tmp/p9ktest %k%F{004}%f " "$(build_left_prompt)" + + cd - + rm -fr $FOLDER + HOME="${SAVED_HOME}" +} + source shunit2/shunit2