diff --git a/lib/init.spec.lua b/lib/init.spec.lua index f8fc03a..ed333b6 100644 --- a/lib/init.spec.lua +++ b/lib/init.spec.lua @@ -1,6 +1,26 @@ return function() local t = require(script.Parent) + it("should support type checking with type()", function() + assert(t.type("nil")(nil)) + assert(t.type("boolean")(true)) + assert(t.type("string")("foo")) + assert(t.type("number")(123)) + assert(t.type("table")({})) + assert(t.type("userdata")(newproxy())) + assert(t.type("function")(function() end)) + assert(t.type("thread")(coroutine.running())) + + assert(not t.type("nil")(true)) + assert(not t.type("boolean")("true")) + assert(not t.type("string")(123)) + assert(not t.type("number")("123")) + assert(not t.type("table")("{}")) + assert(not t.type("userdata")(nil)) + assert(not t.type("function")("function")) + assert(not t.type("thread")("thread")) + end) + it("should support basic types", function() assert(t.any("")) assert(t.boolean(true))