2022-02-20 01:17:36 +01:00
|
|
|
--Make sure the type checking works
|
|
|
|
|
|
|
|
describe("smr type checking",function()
|
|
|
|
it("should load without errors",function()
|
|
|
|
local types = require("types")
|
|
|
|
end)
|
|
|
|
it("should not error when an argument is a number",function()
|
|
|
|
local types = require("types")
|
|
|
|
local n = 5
|
|
|
|
assert(types.number(n))
|
|
|
|
end)
|
|
|
|
it("should error when an argument is a table",function()
|
|
|
|
local types = require("types")
|
|
|
|
local t = {}
|
|
|
|
assert.has.errors(function()
|
|
|
|
types.number(t)
|
|
|
|
end)
|
|
|
|
end)
|
2022-09-03 01:24:39 +02:00
|
|
|
it("should check multiple types passed as arugments", function()
|
|
|
|
local types = require("types")
|
|
|
|
local num, tbl = 5, {}
|
|
|
|
types.check(num, types.number, nil)
|
|
|
|
end)
|
2022-02-20 01:17:36 +01:00
|
|
|
end)
|
|
|
|
|
|
|
|
|