summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish
blob: b8559669321b40c378cc1d42d5c32c0f41a8fc24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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