From dba80dbee922fee79b8709ac7fa981867bed89c5 Mon Sep 17 00:00:00 2001 From: Christo Kotze Date: Wed, 14 Feb 2018 13:48:25 +0400 Subject: [PATCH] Added tests for other folder highlighing --- test/segments/dir.spec | 82 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/test/segments/dir.spec b/test/segments/dir.spec index 41f82eca..221ccea2 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -62,7 +62,7 @@ function testTruncationFromRightWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789%b% %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{blue} %F{black}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789%b %k%F{blue}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test @@ -437,7 +437,29 @@ function testBoldHomeDirectoryWorks() { unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } -function testBoldOtherDirectoryWorks() { +function testBoldHomeSubdirWorks() { + POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + mkdir -p ~/powerlevel9k-test + cd ~/powerlevel9k-test + + assertEquals "%K{blue} %F{black}~/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + rm -fr ~/powerlevel9k-test + unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD +} + +function testBoldRootDirectoryWorks() { + POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true + cd / + + assertEquals "%K{blue} %F{black}%B/%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD +} + +function testBoldRootSubdirWorks() { POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=true cd /tmp @@ -447,7 +469,17 @@ function testBoldOtherDirectoryWorks() { unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD } -function testDirHighlightHomeWorks() { +function testBoldRootSubsubdirWorks() { + mkdir -p /tmp/powerlevel9k-test + cd /tmp/powerlevel9k-test + + assertEquals "%K{blue} %F{black}/tmp/%Bpowerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + rm -fr /tmp/powerlevel9k-test +} + +function testHighlightHomeWorks() { POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' cd ~ @@ -457,4 +489,48 @@ function testDirHighlightHomeWorks() { unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND } +function testHighlightHomeSubdirWorks() { + POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + mkdir -p ~/powerlevel9k-test + cd ~/powerlevel9k-test + + assertEquals "%K{blue} %F{black}~/%F{red}powerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + rm -fr ~/powerlevel9k-test + unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND +} + +function testHighlightRootWorks() { + POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + cd / + + assertEquals "%K{blue} %F{black}%F{red}/%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND +} + +function testHighlightRootSubdirDirectoryWorks() { + POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + cd /tmp + + assertEquals "%K{blue} %F{black}/%F{red}tmp%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND +} + +function testHighlightRootSubdirDirectoryWorks() { + POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND='red' + mkdir /tmp/powerlevel9k-test + cd /tmp/powerlevel9k-test + + assertEquals "%K{blue} %F{black}/tmp/%F{red}powerlevel9k-test%b %k%F{blue}%f " "$(build_left_prompt)" + + cd - + rm -fr /tmp/powerlevel9k-test + unset POWERLEVEL9K_DIR_PATH_HIGHLIGHT_FOREGROUND +} + source shunit2/source/2.1/src/shunit2