write all failed test into the quickfix list
This commit is contained in:
@@ -2201,6 +2201,63 @@ describe("test-samurai output detail view", function()
|
||||
vim.fn.jobstart = orig_jobstart
|
||||
end)
|
||||
|
||||
it("schliesst den Test-Container und springt mit <leader>qn zum ersten Quickfix-Eintrag", function()
|
||||
local orig_jobstart = vim.fn.jobstart
|
||||
vim.fn.jobstart = function(_cmd, opts)
|
||||
if opts and opts.on_stdout then
|
||||
opts.on_stdout(1, {
|
||||
vim.json.encode({ Action = "fail", Test = "TestFoo" }),
|
||||
}, nil)
|
||||
end
|
||||
if opts and opts.on_exit then
|
||||
opts.on_exit(1, 1, nil)
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
local root = vim.fs.joinpath(vim.loop.cwd(), "tests", "tmp_qf_jump")
|
||||
vim.fn.mkdir(root, "p")
|
||||
local target = root .. "/output_detail_qn_test.go"
|
||||
vim.fn.writefile({
|
||||
"package foo",
|
||||
"",
|
||||
"func TestFoo(t *testing.T) {",
|
||||
"}",
|
||||
}, target)
|
||||
|
||||
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_name(bufnr, target)
|
||||
vim.bo[bufnr].filetype = "go"
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, {
|
||||
"package foo",
|
||||
"",
|
||||
"func TestFoo(t *testing.T) {",
|
||||
"}",
|
||||
})
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
|
||||
test_samurai.test_file()
|
||||
|
||||
local wins = find_float_wins()
|
||||
assert.equals(1, #wins)
|
||||
|
||||
vim.wait(20, function()
|
||||
return #vim.fn.getqflist() > 0
|
||||
end)
|
||||
|
||||
local keys = vim.api.nvim_replace_termcodes("<leader>qn", true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, "x", false)
|
||||
vim.wait(20, function()
|
||||
return #find_float_wins() == 0
|
||||
end)
|
||||
|
||||
assert.equals(target, vim.api.nvim_buf_get_name(0))
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
assert.equals(3, cursor[1])
|
||||
|
||||
vim.fn.jobstart = orig_jobstart
|
||||
end)
|
||||
|
||||
it("disables hardtime in listing/detail and restores on close", function()
|
||||
local orig_hardtime = package.loaded["hardtime"]
|
||||
local disable_calls = 0
|
||||
|
||||
Reference in New Issue
Block a user