summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish
diff options
context:
space:
mode:
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish51
1 files changed, 51 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish
new file mode 100644
index 00000000..b8559669
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish
@@ -0,0 +1,51 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+test "Exit code not enabled by default"
+ (
+ set sf_exit_code 1
+ ) = (__sf_section_exit_code)
+end
+
+test "Enable exit-code, shows exit code upon fail"
+ (
+ set SPACEFISH_EXIT_CODE_SHOW true
+ set sf_exit_code 1
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n "✘1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_exit_code)
+end
+
+test "Hides exit code upon success"
+ (
+ set SPACEFISH_EXIT_CODE_SHOW true
+ set sf_exit_code 0
+ ) = (__sf_section_exit_code)
+end
+
+test "Color-changing exit code"
+ (
+ set SPACEFISH_EXIT_CODE_SHOW true
+ set SPACEFISH_EXIT_CODE_COLOR "purple"
+ set sf_exit_code 1
+
+ set_color --bold
+ set_color normal
+ set_color --bold purple
+ echo -n "✘1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_exit_code)
+end