add convenient keymaps for test-command inspection
This commit is contained in:
@@ -222,13 +222,20 @@ describe("test-samurai core (no bundled runners)", function()
|
||||
local listing_buf = vim.api.nvim_get_current_buf()
|
||||
local maps = vim.api.nvim_buf_get_keymap(listing_buf, "n")
|
||||
local has_help = false
|
||||
local has_cb = false
|
||||
local has_cj = false
|
||||
for _, map in ipairs(maps) do
|
||||
if map.lhs == "?" then
|
||||
has_help = true
|
||||
break
|
||||
elseif map.lhs and map.lhs:sub(-2) == "cb" then
|
||||
has_cb = true
|
||||
elseif map.lhs and map.lhs:sub(-2) == "cj" then
|
||||
has_cj = true
|
||||
end
|
||||
end
|
||||
assert.is_true(has_help)
|
||||
assert.is_true(has_cb)
|
||||
assert.is_true(has_cj)
|
||||
|
||||
core.show_help()
|
||||
|
||||
@@ -239,10 +246,41 @@ describe("test-samurai core (no bundled runners)", function()
|
||||
assert.is_true(joined:find("TSamShowOutput", 1, true) ~= nil)
|
||||
assert.is_true(joined:find("<leader>tn", 1, true) ~= nil)
|
||||
assert.is_true(joined:find("<leader>to", 1, true) ~= nil)
|
||||
assert.is_true(joined:find("<leader>cb", 1, true) ~= nil)
|
||||
assert.is_true(joined:find("<leader>cj", 1, true) ~= nil)
|
||||
assert.is_true(joined:find("breaks test-command onto multiple lines", 1, true) ~= nil)
|
||||
assert.is_true(joined:find("joins test-command onto single line", 1, true) ~= nil)
|
||||
|
||||
vim.fn.jobstart = orig_jobstart
|
||||
end)
|
||||
|
||||
it("applies listing break/join substitutions", function()
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_set_current_buf(buf)
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, {
|
||||
"alpha -- beta",
|
||||
"gamma -- delta",
|
||||
})
|
||||
|
||||
core.listing_break_on_dashes()
|
||||
|
||||
local broken = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
|
||||
assert.same({
|
||||
"alpha \\",
|
||||
"\t-- beta",
|
||||
"gamma \\",
|
||||
"\t-- delta",
|
||||
}, broken)
|
||||
|
||||
core.listing_join_backslashes()
|
||||
|
||||
local joined = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
|
||||
assert.same({
|
||||
"alpha -- beta",
|
||||
"gamma -- delta",
|
||||
}, joined)
|
||||
end)
|
||||
|
||||
it("filters listing entries and restores them", function()
|
||||
local runner = {
|
||||
name = "test-runner-filter",
|
||||
|
||||
Reference in New Issue
Block a user