Skip to content

Commit 0a118e2

Browse files
committed
ci: added testing for fzf load|start events
1 parent 454855f commit 0a118e2

20 files changed

Lines changed: 118 additions & 17 deletions

tests/api_spec.lua

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,47 @@ T["api"]["fzf_live"]["rg"]["no error"] = new_set(
175175
}
176176
)
177177

178+
T["api"]["events"] = new_set(
179+
{ parametrize = { { "fzf_exec" }, { "fzf_live" } } },
180+
{
181+
function(api)
182+
local prompt = "EventsPrompt>"
183+
local var_pre, var_post = "$", ""
184+
if helpers.IS_WIN() then var_pre, var_post = "%%", "%%" end
185+
helpers.FzfLua[api](child,
186+
api == "fzf_exec"
187+
and [[(function() return { "foo", "bar", "baz" } end)()]]
188+
or [[function() return { "foo", "bar", "baz" } end ]],
189+
{
190+
__expect_lines = true,
191+
prompt = prompt,
192+
exec_empty_query = true,
193+
actions = {
194+
start = {
195+
fn = function(s) _G._fzf_prompt = s[1] end,
196+
-- field_index = string.format("%sFZF_PROMPT%s", var_pre, var_post),
197+
field_index = "$FZF_PROMPT $FZF_TOTAL_COUNT",
198+
exec_silent = true,
199+
},
200+
load = {
201+
fn = function(s) _G._fzf_total_count = tonumber(s[2]) end,
202+
-- field_index = string.format("%sFZF_PROMPT%s %sFZF_TOTAL_COUNT%s",
203+
-- var_pre, var_post, var_pre, var_post),
204+
field_index = "$FZF_PROMPT $FZF_TOTAL_COUNT",
205+
exec_silent = true,
206+
},
207+
},
208+
__after_open = function()
209+
child.wait_until(function()
210+
return child.lua_get([[_G._fzf_prompt]]) == prompt
211+
end)
212+
child.wait_until(function()
213+
return child.lua_get([[_G._fzf_total_count]]) == 3
214+
end)
215+
end,
216+
})
217+
end
218+
}
219+
)
220+
178221
return T
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--|---------|---------|---------|---------|---------|---------|----
2+
01|
3+
02|~
4+
03|~ ╭─────────────────────────────────────────────────╮
5+
04|~ │EventsPrompt> 3/3 │
6+
05|~ │──────────────────────────────────────────────── │
7+
06|~ │▌ foo │
8+
07|~ │ bar │
9+
08|~ │ baz │
10+
09|~ │ │
11+
10|~ │ │
12+
11|~ │ │
13+
12|~ │ │
14+
13|~ │ │
15+
14|~ │ │
16+
15|~ │ │
17+
16|~ │ │
18+
17|~ │ │
19+
18|~ │ │
20+
19|~ │ │
21+
20|~ │ │
22+
21|~ │ │
23+
22|~ ╰─────────────────────────────────────────────────╯
24+
23|~
25+
24|[No Name] 0,0-1 All
26+
25|
27+
26|
28+
27|
29+
28|-- TERMINAL -- 1,0-1 All
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--|---------|---------|---------|---------|---------|---------|----
2+
01|
3+
02|~
4+
03|~ ╭─────────────────────────────────────────────────╮
5+
04|~ │EventsPrompt> 3/3 │
6+
05|~ │──────────────────────────────────────────────── │
7+
06|~ │▌ foo │
8+
07|~ │ bar │
9+
08|~ │ baz │
10+
09|~ │ │
11+
10|~ │ │
12+
11|~ │ │
13+
12|~ │ │
14+
13|~ │ │
15+
14|~ │ │
16+
15|~ │ │
17+
16|~ │ │
18+
17|~ │ │
19+
18|~ │ │
20+
19|~ │ │
21+
20|~ │ │
22+
21|~ │ │
23+
22|~ ╰─────────────────────────────────────────────────╯
24+
23|~
25+
24|[No Name] 0,0-1 All
26+
25|
27+
26|
28+
27|
29+
28|-- TERMINAL -- 1,0-1 All

tests/screenshots/tests-api_spec.lua---api---fzf_exec---rg---1-+-args-{-1-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭─────────────────────────────────────────────────╮
5-
04|~ │> 118/118
5+
04|~ │> 120/120
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ LICENSE ││
88
07|~ │ Makefile ││

tests/screenshots/tests-api_spec.lua---api---fzf_exec---rg---1-+-args-{-false-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭─────────────────────────────────────────────────╮
5-
04|~ │> 119/119
5+
04|~ │> 121/121
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [st] rg --files -g "!.git" --sort=path││
88
07|~ │ LICENSE ││

tests/screenshots/tests-api_spec.lua---api---fzf_exec---rg---1-+-args-{-true-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭─────────────────────────────────────────────────╮
5-
04|~ │> 119/119
5+
04|~ │> 121/121
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] rg --files -g "!.git" --sort=path││
88
07|~ │ LICENSE ││

tests/screenshots/tests-file-ui_spec.lua---files---close-abort---1-+-args-{-'-c-c-'-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭───────────────────── Files ─────────────────────╮
5-
04|~ │> 119/119 (0) │
5+
04|~ │> 121/121 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] rg --files --sort=path ││
88
07|~ │ LICENSE ││

tests/screenshots/tests-file-ui_spec.lua---files---close-abort---1-+-args-{-'-esc-'-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭───────────────────── Files ─────────────────────╮
5-
04|~ │> 119/119 (0) │
5+
04|~ │> 121/121 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] rg --files --sort=path ││
88
07|~ │ LICENSE ││

tests/screenshots/tests-file-ui_spec.lua---files---executable---1-+-args-{-'fd'-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭─────────────────── Files h ────────────────────╮
5-
04|~ │> 130/130 (0) │
5+
04|~ │> 132/132 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] fd --hidden --color=never --typ··││
88
07|~ │ .editorconfig │

tests/screenshots/tests-file-ui_spec.lua---files---executable---1-+-args-{-'find-dir'-}

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
01|
33
02|~
44
03|~ ╭───────────────────── Files ─────────────────────╮
5-
04|~ │> 130/130 (0) │
5+
04|~ │> 132/132 (0) │
66
05|~ │──────────────────────────────────────────────── │
77
06|~ │▌ [DEBUG] [mt] find . -type f \! -path '*/.git··││
88
07|~ │ .editorconfig │

0 commit comments

Comments
 (0)