diff --git a/spec/integration/comment_test.lua b/spec/integration/comment_test.lua index e381908..38e7909 100644 --- a/spec/integration/comment_test.lua +++ b/spec/integration/comment_test.lua @@ -1,6 +1,5 @@ local t = require "spec.testutils" - -local child, T = t.setup() +local child, T = t.setup "comment" local function do_the_test(fixture, pos) local rs = t.setup_test("comment/" .. fixture, child, pos) @@ -11,7 +10,6 @@ local function do_the_test(fixture, pos) t.cleanup(rs) end -T["comment"] = MiniTest.new_set {} T["comment"]["should add comment to package"] = function() do_the_test("package", { 1, 1 }) end diff --git a/spec/integration/gotests_test.lua b/spec/integration/gotests_test.lua index a2f432f..fcba8a7 100644 --- a/spec/integration/gotests_test.lua +++ b/spec/integration/gotests_test.lua @@ -1,7 +1,5 @@ local t = require "spec.testutils" - -local child, T = t.setup() -T["gotests"] = MiniTest.new_set {} +local child, T = t.setup "gotests" --- NOTE: :GoTestAdd is the only place that has actual logic --- All other parts are handled `gotests` itself. diff --git a/spec/integration/iferr_test.lua b/spec/integration/iferr_test.lua index c07536a..84cf8d6 100644 --- a/spec/integration/iferr_test.lua +++ b/spec/integration/iferr_test.lua @@ -1,7 +1,6 @@ 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() local rs = t.setup_test("iferr/iferr", child, { 8, 2 }) child.cmd "GoIfErr" diff --git a/spec/integration/impl_test.lua b/spec/integration/impl_test.lua index b2fae88..a70b581 100644 --- a/spec/integration/impl_test.lua +++ b/spec/integration/impl_test.lua @@ -1,7 +1,6 @@ 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() local rs = t.setup_test("impl/writer", child, { 3, 0 }) child.cmd "GoImpl w io.Writer" diff --git a/spec/integration/struct_tags_test.lua b/spec/integration/struct_tags_test.lua index bd72dab..1c97001 100644 --- a/spec/integration/struct_tags_test.lua +++ b/spec/integration/struct_tags_test.lua @@ -1,7 +1,6 @@ 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() local rs = t.setup_test("tags/add", child, { 3, 6 }) child.cmd "GoTagAdd json" diff --git a/spec/testutils.lua b/spec/testutils.lua index 3664402..1a31e10 100644 --- a/spec/testutils.lua +++ b/spec/testutils.lua @@ -6,8 +6,9 @@ local testutils = {} testutils.mininit_path = vim.fs.joinpath(base_dir, "scripts", "minimal_init.lua") testutils.fixtures_dir = vim.fs.joinpath(base_dir, "spec/fixtures") +---@param name string ---@return MiniTest.child, table -function testutils.setup() +function testutils.setup(name) local child = MiniTest.new_child_neovim() local T = MiniTest.new_set { hooks = { @@ -18,6 +19,7 @@ function testutils.setup() }, } + T[name] = MiniTest.new_set {} return child, T end