feat(iferr): add -message support (#89)

* feat(iferr): add *-message* support

* generate docs
This commit is contained in:
Smirnov Oleksandr 2025-03-03 14:22:28 +02:00 committed by GitHub
parent bb31271311
commit d1a21bffab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 48 additions and 1 deletions

View file

@ -23,4 +23,18 @@ T["iferr"]["works"] = function()
t.eq(t.readfile(tmp), fixtures.output)
end
T["iferr"]["works with custom message"] = function()
local tmp = t.tmpfile()
local fixtures = t.get_fixtures "iferr/message"
t.writefile(tmp, fixtures.input)
child.lua [[ require("gopher").setup { iferr = { message = 'fmt.Errorf("failed to %w", err)' } } ]]
child.cmd("silent edit " .. tmp)
child.fn.setpos(".", { child.fn.bufnr "%", 6, 2, 0 })
child.cmd "GoIfErr"
child.cmd "write"
t.eq(t.readfile(tmp), fixtures.output)
end
return T