some tests refactoring and sep by type
This commit is contained in:
parent
de37564c79
commit
ab874c6c4f
8 changed files with 46 additions and 87 deletions
22
spec/unit/config_spec.lua
Normal file
22
spec/unit/config_spec.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
describe("unit.gopher.config", function()
|
||||
it("can be required", function()
|
||||
require "gopher.config"
|
||||
end)
|
||||
|
||||
describe(".setup()", function()
|
||||
local c = require "gopher.config"
|
||||
|
||||
it("returns defaults when gets empty table", function()
|
||||
c.setup {}
|
||||
assert.are.same(c.config.commands.go, "go")
|
||||
assert.are.same(c.config.commands.gomodifytags, "gomodifytags")
|
||||
assert.are.same(c.config.commands.gotests, "gotests")
|
||||
assert.are.same(c.config.commands.impl, "impl")
|
||||
end)
|
||||
|
||||
it("can set user opts", function()
|
||||
c.setup { commands = { go = "custom_go" } }
|
||||
assert.are.same(c.config.commands.go, "custom_go")
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
19
spec/unit/utils_spec.lua
Normal file
19
spec/unit/utils_spec.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
describe("gopher._utils", function()
|
||||
it("can be requried", function()
|
||||
require "gopher._utils"
|
||||
end)
|
||||
|
||||
describe(".empty()", function()
|
||||
local empty = require("gopher._utils").empty
|
||||
|
||||
it("with non-empty talbe", function()
|
||||
local res = empty { first = "1", second = 2 }
|
||||
assert.are.same(res, false)
|
||||
end)
|
||||
|
||||
it("with empty talbe", function()
|
||||
local res = empty {}
|
||||
assert.are.same(res, true)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue