test: unit (#97)
* refactor(utils): remove unused function * fix(installer): actually pass what should be passed * docs: add explanation comment * test: add utils * refactor(utils): flatten the dir of files * remove .luarc
This commit is contained in:
parent
9aa0038125
commit
7af08c9780
8 changed files with 39 additions and 26 deletions
29
spec/unit/utils_test.lua
Normal file
29
spec/unit/utils_test.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
local t = require "spec.testutils"
|
||||
local child = MiniTest.new_child_neovim()
|
||||
local T = MiniTest.new_set {
|
||||
hooks = {
|
||||
post_once = child.stop,
|
||||
pre_case = function()
|
||||
child.restart { "-u", t.mininit_path }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
T["utils"] = MiniTest.new_set()
|
||||
T["utils"]["should .remove_empty_lines()"] = function()
|
||||
local u = require "gopher._utils"
|
||||
local inp = { "hi", "", "a", "", "", "asdf" }
|
||||
|
||||
t.eq(u.remove_empty_lines(inp), { "hi", "a", "asdf" })
|
||||
end
|
||||
|
||||
T["utils"]["should .readfile_joined()"] = function()
|
||||
local data = "line1\nline2\nline3"
|
||||
local tmp = t.tmpfile()
|
||||
local u = require "gopher._utils"
|
||||
|
||||
t.writefile(tmp, data)
|
||||
t.eq(u.readfile_joined(tmp), data)
|
||||
end
|
||||
|
||||
return T
|
||||
Loading…
Add table
Add a link
Reference in a new issue