Skip to content

Commit

Permalink
Add tests for t.type()
Browse files Browse the repository at this point in the history
  • Loading branch information
osyrisrblx committed Jun 26, 2024
1 parent 1cc99be commit 6a9752e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/init.spec.lua
Original file line number Diff line number Diff line change
@@ -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))
Expand Down

0 comments on commit 6a9752e

Please sign in to comment.