Skip to content

Commit

Permalink
Table tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Dec 10, 2024
1 parent d90d15a commit 5caf878
Show file tree
Hide file tree
Showing 2 changed files with 198 additions and 174 deletions.
12 changes: 12 additions & 0 deletions ci/Test.luau
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type TestExpect = {
ToBe: (self: TestExpect, value: any) -> (),
ToBeNaN: (self: TestExpect, value: any) -> (),
ToBeNil: (self: TestExpect) -> (),
ToBeOk: (self: TestExpect) -> (),
ToBeTruthy: (self: TestExpect) -> (),
ToBeFalsy: (self: TestExpect) -> (),
ToThrow: (self: TestExpect, err: any?) -> (),
Expand Down Expand Up @@ -42,6 +43,17 @@ function TestExpect:ToBeNil()
end
end

function TestExpect:ToBeOk()
local condition = self.Value ~= nil
if self.Flip then
condition = not condition
end

if not condition then
error(`{self.Value} {if self.Flip then "is not" else "is"} ok`, 0)
end
end

function TestExpect:ToBeNaN()
local condition = self.Value ~= self.Value
if self.Flip then
Expand Down
Loading

0 comments on commit 5caf878

Please sign in to comment.