summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish
diff options
context:
space:
mode:
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish117
1 files changed, 117 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish
new file mode 100644
index 00000000..fc5ed29c
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish
@@ -0,0 +1,117 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+test "Displays only the colored content when 2 arguments are passed"
+ (
+ set_color --bold
+ echo -n ""
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n ""
+ set_color normal
+ ) = (__sf_lib_section red "test content")
+end
+
+test "Displays the prefix, colored content and suffix when 4 arguments are passed"
+ (
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Displays the prefix if prefixes are enabled"
+ (
+ set SPACEFISH_PROMPT_PREFIXES_SHOW true
+
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Doesn't display the prefix if prefixes are disabled"
+ (
+ set SPACEFISH_PROMPT_PREFIXES_SHOW false
+
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Displays the suffix if suffixes are enabled"
+ (
+ set SPACEFISH_PROMPT_SUFFIXES_SHOW true
+
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Doesn't display the suffix if suffixes are disabled"
+ (
+ set SPACEFISH_PROMPT_SUFFIXES_SHOW false
+
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Only prints the prefix for the second consecutive section"
+ (
+ set sf_prompt_opened false
+
+ set_color --bold red
+ echo -n "test content 1"
+ set_color normal
+ set_color --bold
+ echo -n "suffix 1"
+ set_color normal
+
+ set_color --bold
+ echo -n "prefix 2"
+ set_color normal
+ set_color --bold red
+ echo -n "test content 2"
+ set_color normal
+ set_color --bold
+ echo -n "suffix 2"
+ set_color normal
+ ) = (
+ __sf_lib_section red "prefix 1" "test content 1" "suffix 1"
+ __sf_lib_section red "prefix 2" "test content 2" "suffix 2"
+ )
+end