|
| 1 | +---@diagnostic disable: unused-local, unused-function |
| 2 | +local MiniTest = require("mini.test") |
| 3 | +local helpers = require("fzf-lua.test.helpers") |
| 4 | +local child = helpers.new_child_neovim() |
| 5 | +local expect, eq = helpers.expect, helpers.expect.equality |
| 6 | +local new_set = MiniTest.new_set |
| 7 | + |
| 8 | +---@format disable-next |
| 9 | +local reload = function(config) child.unload(); child.setup(config) end |
| 10 | +local sleep = function(ms) helpers.sleep(ms, child) end |
| 11 | +local exec_lua = child.lua |
| 12 | +--stylua: ignore end |
| 13 | + |
| 14 | +local T = helpers.new_set_with_child(child) |
| 15 | + |
| 16 | +T["actions"] = new_set({ n_retry = not helpers.IS_LINUX() and 5 or nil }) |
| 17 | + |
| 18 | +T["actions"]["ui don't freeze on error"] = function() |
| 19 | + -- reload({ "hide" }) |
| 20 | + exec_lua( |
| 21 | + [[FzfLua.fzf_exec({ "aaa", "bbb" }, { |
| 22 | + actions = { enter = { fn = error, exec_silent = true } }, |
| 23 | + })]]) |
| 24 | + child.wait_until(function() return child.lua_get([[_G._fzf_load_called]]) == true end) |
| 25 | + child.type_keys("<cr>") |
| 26 | + child.type_keys("ui should not freeze on action error") |
| 27 | + vim.uv.sleep(100 * (not helpers.IS_LINUX() and 5 or 1)) |
| 28 | + child.expect_screen_lines({ redraw = true }) |
| 29 | + |
| 30 | + exec_lua([[FzfLua.fzf_exec(function(cb) cb(1) cb(2) error("eff") end)]]) |
| 31 | + child.wait_until(function() return child.lua_get([[_G._fzf_load_called]]) == true end) |
| 32 | + child.type_keys("ui should not freeze on content error") |
| 33 | + vim.uv.sleep(100 * (not helpers.IS_LINUX() and 5 or 1)) |
| 34 | + child.expect_screen_lines({ ignore_text = { 28 } }) |
| 35 | +end |
| 36 | + |
| 37 | +return T |
0 commit comments