Add initial test suite
This commit is contained in:
1 parent
fd895cf6ba
commit
c533ca3794
2 files changed
+25
No files matched your search
@@ -98,6 +98,13 @@ function get_releases(branch, destdir)
|
||||
return t
|
||||
end
|
||||
|
||||
-- return functions as module for unit testing
|
||||
if not string.match(arg[0], "fetch%-latest%-releases") then
|
||||
return {
|
||||
fatal = fatal,
|
||||
}
|
||||
end
|
||||
|
||||
local branch = arg[1] or "edge"
|
||||
local destdir = arg[2] or "out"
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
describe("test fetch-latest-releases functions", function()
|
||||
local f
|
||||
setup(function()
|
||||
f = require("fetch-latest-releases")
|
||||
end)
|
||||
|
||||
teardown(function()
|
||||
f = nil
|
||||
end)
|
||||
|
||||
describe("test fatal", function()
|
||||
it("should call os.exit", function()
|
||||
stub(os, "exit")
|
||||
f.fatal("hello")
|
||||
assert.stub(os.exit).was_called_with(1)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
Reference in new issue
Block a user