refactor(tests): clean up everywhere
This commit is contained in:
parent
1cb507fa40
commit
b2780c8efb
6 changed files with 30 additions and 7 deletions
|
|
@ -16,9 +16,7 @@ local function do_the_test(fixture, pos)
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
|
||||
-- without it all other(not even from this module) tests are falling
|
||||
t.deletefile(rs.tmp)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["comment"] = MiniTest.new_set {}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ T["gotests"]["should add test for function under cursor"] = function()
|
|||
child.cmd "GoTestAdd"
|
||||
|
||||
t.eq(rs.fixtures.output, read_testfile(rs.tmp))
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["gotests"]["should add test for method under cursor"] = function()
|
||||
|
|
@ -32,6 +33,7 @@ T["gotests"]["should add test for method under cursor"] = function()
|
|||
child.cmd "GoTestAdd"
|
||||
|
||||
t.eq(rs.fixtures.output, read_testfile(rs.tmp))
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ T["iferr"]["works"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["iferr"]["works with custom message"] = function()
|
||||
|
|
@ -29,6 +30,7 @@ T["iferr"]["works with custom message"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ T["impl"]["works w io.Writer"] = function()
|
|||
-- NOTE: since "impl" won't implement interface if it's already implemented i went with this hack
|
||||
local rhs = rs.fixtures.output:gsub("Test2", "Test")
|
||||
t.eq(t.readfile(rs.tmp), rhs)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["impl"]["works r Read io.Reader"] = function()
|
||||
|
|
@ -27,6 +28,7 @@ T["impl"]["works r Read io.Reader"] = function()
|
|||
|
||||
local rhs = rs.fixtures.output:gsub("Read2", "Read")
|
||||
t.eq(t.readfile(rs.tmp), rhs)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["impl"]["works io.Closer"] = function()
|
||||
|
|
@ -36,6 +38,7 @@ T["impl"]["works io.Closer"] = function()
|
|||
|
||||
local rhs = rs.fixtures.output:gsub("Test2", "Test")
|
||||
t.eq(t.readfile(rs.tmp), rhs)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ T["struct_tags"]["should add tag"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["struct_tags"]["should remove tag"] = function()
|
||||
|
|
@ -24,6 +25,7 @@ T["struct_tags"]["should remove tag"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["struct_tags"]["should be able to handle many structs"] = function()
|
||||
|
|
@ -32,6 +34,7 @@ T["struct_tags"]["should be able to handle many structs"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["struct_tags"]["should clear struct"] = function()
|
||||
|
|
@ -40,6 +43,7 @@ T["struct_tags"]["should clear struct"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["struct_tags"]["should add more than one tag"] = function()
|
||||
|
|
@ -60,6 +64,9 @@ T["struct_tags"]["should add more than one tag"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(tmp), fixtures.output)
|
||||
|
||||
---@diagnostic disable-next-line:missing-fields
|
||||
t.cleanup { tmp = tmp }
|
||||
end
|
||||
|
||||
T["struct_tags"]["should add tags on var"] = function()
|
||||
|
|
@ -68,6 +75,7 @@ T["struct_tags"]["should add tags on var"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
T["struct_tags"]["should add tags on short declr var"] = function()
|
||||
|
|
@ -76,6 +84,7 @@ T["struct_tags"]["should add tags on short declr var"] = function()
|
|||
child.cmd "write"
|
||||
|
||||
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
|
||||
t.cleanup(rs)
|
||||
end
|
||||
|
||||
return T
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue