refactor(test): make helper test function more ergonomic
In my opinion, requiring user to access tests via `T["module_name"]` was too fragile and typos prone.
This commit is contained in:
parent
53ab4274c2
commit
e90f766ea3
8 changed files with 40 additions and 38 deletions
|
|
@ -1,7 +1,7 @@
|
|||
local t = require "spec.testutils"
|
||||
local child, T = t.setup "iferr"
|
||||
local child, T, iferr = t.setup "iferr"
|
||||
|
||||
T["iferr"]["should add if != nil {"] = function()
|
||||
iferr["should add if != nil {"] = function()
|
||||
local rs = t.setup_test("iferr/iferr", child, { 8, 2 })
|
||||
child.cmd "GoIfErr"
|
||||
child.cmd "write"
|
||||
|
|
@ -10,7 +10,7 @@ T["iferr"]["should add if != nil {"] = function()
|
|||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["iferr"]["should add if err with custom message"] = function()
|
||||
iferr["should add if err with custom message"] = function()
|
||||
child.lua [[
|
||||
require("gopher").setup {
|
||||
iferr = { message = 'fmt.Errorf("failed to %w", err)' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue