spec(module_doc): add basic test
This commit is contained in:
parent
592e62d6fa
commit
5d45637954
|
@ -1,30 +0,0 @@
|
|||
local assert = require("luassert")
|
||||
|
||||
describe("Busted unit testing framework", function()
|
||||
describe("should be awesome", function()
|
||||
it("should be easy to use", function()
|
||||
assert.truthy "Yup."
|
||||
end)
|
||||
|
||||
it("should have lots of features", function()
|
||||
-- deep check comparisons!
|
||||
assert.same({ table = "great" }, { table = "great" })
|
||||
|
||||
-- or check by reference!
|
||||
assert.not_equal({ table = "great" }, { table = "great" })
|
||||
|
||||
assert.truthy "this is a string" -- truthy: not false or nil
|
||||
|
||||
assert.is_true(1 == 1)
|
||||
|
||||
assert.falsy(nil)
|
||||
assert.has_error(function()
|
||||
error "Wat"
|
||||
end, "Wat")
|
||||
end)
|
||||
|
||||
it("should provide some shortcuts to common functions", function()
|
||||
assert.is_unique { { thing = 1 }, { thing = 2 }, { thing = 3 } }
|
||||
end)
|
||||
end)
|
||||
end)
|
|
@ -1,10 +0,0 @@
|
|||
local assert = require("luassert")
|
||||
local utils = require("utils")
|
||||
|
||||
describe("test", function()
|
||||
it("has_item", function()
|
||||
local t = {1, 2, 3}
|
||||
assert.equal(utils.has_item(t, 1), 1)
|
||||
assert.is_nil(utils.has_item(t, 4))
|
||||
end)
|
||||
end)
|
|
@ -0,0 +1,22 @@
|
|||
local assert = require("luassert")
|
||||
local scraper = require("scraper").module_doc
|
||||
|
||||
local get_doc_from_page = scraper.get_doc_from_page
|
||||
|
||||
describe("Scrap documentation", function()
|
||||
it("should return a valid AST for an empty module", function()
|
||||
local ast <const>, nodes <const> = get_doc_from_page("", "empty")
|
||||
assert.same(ast, {
|
||||
children = {
|
||||
{
|
||||
children = {},
|
||||
name = "Signal",
|
||||
token = "enum",
|
||||
}
|
||||
},
|
||||
name = "Empty",
|
||||
token = "module",
|
||||
})
|
||||
assert.same(nodes, {})
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue