summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_vi_mode.test.fish
blob: 4a9bda20c828ec6c14c4f980377599fc475e4041 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
source $DIRNAME/spacefish_test_setup.fish

function setup
	spacefish_test_setup
	fish_vi_key_bindings; or true
	# Unfortunately right after enabling vi-keys it's in 'normal' state on CI and in 'insert' locally
	set fish_bind_mode insert
end

test "Prints section when fish_vi_key_bindigs is set"
	(
		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold white
		echo -n "[I]"
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Prints SPACEFISH_VI_MODE_VISUAL when fish_bind_mode is visual"
	(
		set fish_bind_mode visual
		set SPACEFISH_VI_MODE_VISUAL "-V-"

		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold white
		echo -n $SPACEFISH_VI_MODE_VISUAL
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Prints SPACEFISH_VI_MODE_REPLACE_ONE when fish_bind_mode is replace_one"
	(
		set fish_bind_mode replace_one
		set SPACEFISH_VI_MODE_REPLACE_ONE "-R-"

		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold white
		echo -n $SPACEFISH_VI_MODE_REPLACE_ONE
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Prints SPACEFISH_VI_MODE_NORMAL when fish_bind_mode is normal"
	(
		set fish_bind_mode default
		set SPACEFISH_VI_MODE_NORMAL "-N-"

		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold white
		echo -n $SPACEFISH_VI_MODE_NORMAL
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Prints SPACEFISH_VI_MODE_INSERT when fish_bind_mode is insert"
	(
		set fish_bind_mode insert
		set SPACEFISH_VI_MODE_INSERT "-I-"

		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold white
		echo -n $SPACEFISH_VI_MODE_INSERT
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Prints prefix when SPACEFISH_VI_MODE_PREFIX is set"
	(
		set SPACEFISH_VI_MODE_PREFIX "VIM "

		set_color --bold
		echo -n "$SPACEFISH_VI_MODE_PREFIX"
		set_color normal
		set_color --bold white
		echo -n "[I]"
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Prints suffix when SPACEFISH_VI_MODE_SUFFIX is set"
	(
		set SPACEFISH_VI_MODE_SUFFIX " VIM "

		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold white
		echo -n "[I]"
		set_color normal
		set_color --bold
		echo -n $SPACEFISH_VI_MODE_SUFFIX
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Use color from SPACEFISH_VI_MODE_COLOR"
	(
		set SPACEFISH_VI_MODE_COLOR red

		set_color --bold
		echo -n " "
		set_color normal
		set_color --bold red
		echo -n "[I]"
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_vi_mode)
end

test "Don't print anything if SPACEFISH_VI_MODE_SHOW is false"
	(
		set SPACEFISH_VI_MODE_SHOW false
	) = (__sf_section_vi_mode)
end