refactor(tests): soon it will be too far
This commit is contained in:
parent
2ca302a7a5
commit
4bf2806537
6 changed files with 8 additions and 13 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
local t = require "spec.testutils"
|
local t = require "spec.testutils"
|
||||||
|
local child, T = t.setup "comment"
|
||||||
local child, T = t.setup()
|
|
||||||
|
|
||||||
local function do_the_test(fixture, pos)
|
local function do_the_test(fixture, pos)
|
||||||
local rs = t.setup_test("comment/" .. fixture, child, pos)
|
local rs = t.setup_test("comment/" .. fixture, child, pos)
|
||||||
|
|
@ -11,7 +10,6 @@ local function do_the_test(fixture, pos)
|
||||||
t.cleanup(rs)
|
t.cleanup(rs)
|
||||||
end
|
end
|
||||||
|
|
||||||
T["comment"] = MiniTest.new_set {}
|
|
||||||
T["comment"]["should add comment to package"] = function()
|
T["comment"]["should add comment to package"] = function()
|
||||||
do_the_test("package", { 1, 1 })
|
do_the_test("package", { 1, 1 })
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
local t = require "spec.testutils"
|
local t = require "spec.testutils"
|
||||||
|
local child, T = t.setup "gotests"
|
||||||
local child, T = t.setup()
|
|
||||||
T["gotests"] = MiniTest.new_set {}
|
|
||||||
|
|
||||||
--- NOTE: :GoTestAdd is the only place that has actual logic
|
--- NOTE: :GoTestAdd is the only place that has actual logic
|
||||||
--- All other parts are handled `gotests` itself.
|
--- All other parts are handled `gotests` itself.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
local t = require "spec.testutils"
|
local t = require "spec.testutils"
|
||||||
|
local child, T = t.setup "iferr"
|
||||||
|
|
||||||
local child, T = t.setup()
|
|
||||||
T["iferr"] = MiniTest.new_set {}
|
|
||||||
T["iferr"]["works"] = function()
|
T["iferr"]["works"] = function()
|
||||||
local rs = t.setup_test("iferr/iferr", child, { 8, 2 })
|
local rs = t.setup_test("iferr/iferr", child, { 8, 2 })
|
||||||
child.cmd "GoIfErr"
|
child.cmd "GoIfErr"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
local t = require "spec.testutils"
|
local t = require "spec.testutils"
|
||||||
|
local child, T = t.setup "impl"
|
||||||
|
|
||||||
local child, T = t.setup()
|
|
||||||
T["impl"] = MiniTest.new_set {}
|
|
||||||
T["impl"]["works w io.Writer"] = function()
|
T["impl"]["works w io.Writer"] = function()
|
||||||
local rs = t.setup_test("impl/writer", child, { 3, 0 })
|
local rs = t.setup_test("impl/writer", child, { 3, 0 })
|
||||||
child.cmd "GoImpl w io.Writer"
|
child.cmd "GoImpl w io.Writer"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
local t = require "spec.testutils"
|
local t = require "spec.testutils"
|
||||||
|
local child, T = t.setup "struct_tags"
|
||||||
|
|
||||||
local child, T = t.setup()
|
|
||||||
T["struct_tags"] = MiniTest.new_set {}
|
|
||||||
T["struct_tags"]["should add tag"] = function()
|
T["struct_tags"]["should add tag"] = function()
|
||||||
local rs = t.setup_test("tags/add", child, { 3, 6 })
|
local rs = t.setup_test("tags/add", child, { 3, 6 })
|
||||||
child.cmd "GoTagAdd json"
|
child.cmd "GoTagAdd json"
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,9 @@ local testutils = {}
|
||||||
testutils.mininit_path = vim.fs.joinpath(base_dir, "scripts", "minimal_init.lua")
|
testutils.mininit_path = vim.fs.joinpath(base_dir, "scripts", "minimal_init.lua")
|
||||||
testutils.fixtures_dir = vim.fs.joinpath(base_dir, "spec/fixtures")
|
testutils.fixtures_dir = vim.fs.joinpath(base_dir, "spec/fixtures")
|
||||||
|
|
||||||
|
---@param name string
|
||||||
---@return MiniTest.child, table
|
---@return MiniTest.child, table
|
||||||
function testutils.setup()
|
function testutils.setup(name)
|
||||||
local child = MiniTest.new_child_neovim()
|
local child = MiniTest.new_child_neovim()
|
||||||
local T = MiniTest.new_set {
|
local T = MiniTest.new_set {
|
||||||
hooks = {
|
hooks = {
|
||||||
|
|
@ -18,6 +19,7 @@ function testutils.setup()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
T[name] = MiniTest.new_set {}
|
||||||
return child, T
|
return child, T
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue