run tests independent of user nvim setup (#39)
* chore(lua_ls): now lua_ls knows about testing functions * spec: change way how tests srtuctured * test(config): refactor tests * test: utils * refactor(utils): remove not used function * chore(ci): add test runner * chore(ci): remove taskfile from deps * fix: now it works
This commit is contained in:
parent
b5327cd2eb
commit
5f8466d043
9 changed files with 88 additions and 125 deletions
29
spec/units/config_spec.lua
Normal file
29
spec/units/config_spec.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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)
|
||||
25
spec/units/utils_spec.lua
Normal file
25
spec/units/utils_spec.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
describe("gopher._utils", function()
|
||||
local u = require "gopher._utils"
|
||||
|
||||
describe(".is_tbl_empty()", function()
|
||||
it("it is empty", function()
|
||||
assert.are.same(true, u.is_tbl_empty {})
|
||||
end)
|
||||
|
||||
it("it is not empty", function()
|
||||
assert.are.same(false, u.is_tbl_empty { first = "1", second = 2 })
|
||||
end)
|
||||
end)
|
||||
|
||||
describe(".sreq()", function()
|
||||
it("can require existing module", function()
|
||||
assert.are.same(require "gopher", u.sreq "gopher")
|
||||
end)
|
||||
|
||||
it("cannot require non-existing module", function()
|
||||
assert.has.errors(function()
|
||||
u.sreq "iDontExistBtw"
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue