refactor(tests): start migration to mini.test
This commit is contained in:
parent
6769cafc55
commit
30a26bcda2
8 changed files with 35 additions and 29 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"diagnostics.globals": [
|
"diagnostics.globals": [
|
||||||
|
"MiniTest",
|
||||||
"describe",
|
"describe",
|
||||||
"it",
|
"it",
|
||||||
"before_each",
|
"before_each",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
[vim]
|
[vim]
|
||||||
any = true
|
any = true
|
||||||
|
|
||||||
|
[MiniTest]
|
||||||
|
type = "table"
|
||||||
|
|
||||||
[describe]
|
[describe]
|
||||||
any = true
|
any = true
|
||||||
[[describe.args]]
|
[[describe.args]]
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
describe("gopher.config", function()
|
|
||||||
it(".setup() should provide default when .setup() is not called", function()
|
|
||||||
local c = require "gopher.config"
|
|
||||||
|
|
||||||
assert.are.same(c.commands.go, "go")
|
|
||||||
assert.are.same(c.commands.gomodifytags, "gomodifytags")
|
|
||||||
assert.are.same(c.commands.gotests, "gotests")
|
|
||||||
assert.are.same(c.commands.impl, "impl")
|
|
||||||
assert.are.same(c.commands.iferr, "iferr")
|
|
||||||
assert.are.same(c.commands.dlv, "dlv")
|
|
||||||
end)
|
|
||||||
|
|
||||||
it(".setup() should change options on users config", function()
|
|
||||||
local c = require "gopher.config"
|
|
||||||
c.setup {
|
|
||||||
commands = {
|
|
||||||
go = "go1.420",
|
|
||||||
gomodifytags = "iDontUseRustBtw",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.are.same(c.commands.go, "go1.420")
|
|
||||||
assert.are.same(c.commands.gomodifytags, "iDontUseRustBtw")
|
|
||||||
assert.are.same(c.commands.gotests, "gotests")
|
|
||||||
assert.are.same(c.commands.impl, "impl")
|
|
||||||
assert.are.same(c.commands.iferr, "iferr")
|
|
||||||
assert.are.same(c.commands.dlv, "dlv")
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
31
tests/units/test_config.lua
Normal file
31
tests/units/test_config.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
local eq = MiniTest.expect.equality
|
||||||
|
|
||||||
|
describe("gopher.config", function()
|
||||||
|
it(".setup() should provide default when .setup() is not called", function()
|
||||||
|
local c = require "gopher.config"
|
||||||
|
|
||||||
|
eq(c.commands.go, "go")
|
||||||
|
eq(c.commands.gomodifytags, "gomodifytags")
|
||||||
|
eq(c.commands.gotests, "gotests")
|
||||||
|
eq(c.commands.impl, "impl")
|
||||||
|
eq(c.commands.iferr, "iferr")
|
||||||
|
eq(c.commands.dlv, "dlv")
|
||||||
|
end)
|
||||||
|
|
||||||
|
it(".setup() should change options on users config", function()
|
||||||
|
local c = require "gopher.config"
|
||||||
|
c.setup {
|
||||||
|
commands = {
|
||||||
|
go = "go1.420",
|
||||||
|
gomodifytags = "iDontUseRustBtw",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
eq(c.commands.go, "go1.420")
|
||||||
|
eq(c.commands.gomodifytags, "iDontUseRustBtw")
|
||||||
|
eq(c.commands.gotests, "gotests")
|
||||||
|
eq(c.commands.impl, "impl")
|
||||||
|
eq(c.commands.iferr, "iferr")
|
||||||
|
eq(c.commands.dlv, "dlv")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue