-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbasic_assertions.luau
More file actions
81 lines (67 loc) · 1.92 KB
/
basic_assertions.luau
File metadata and controls
81 lines (67 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
local req = frktest.assert.require
return function()
test.suite("Passing", function()
test.case("The only passing test", function()
check.is_true(true)
end)
end)
test.suite("Check and require", function()
test.case("checks", function()
-- checks dont halt the test
check.equal(1, 100)
check.equal(2, 100)
end)
test.case("require", function()
-- requires do halt the test
req.equal(1, 100)
req.equal(2, 100) -- this will never run
end)
end)
test.suite("Basic type equality", function()
test.case("numbers", function()
check.equal(10, 11)
end)
test.case("booleans", function()
check.equal(false, true)
end)
test.case("strings", function()
check.equal("foo", "bar")
end)
end)
test.suite("Inequality", function()
test.case("not equal", function()
check.not_equal(10, 10)
end)
test.case("greater", function()
check.greater(10, 10)
check.greater_eq(9, 10)
end)
test.case("lesser", function()
check.lesser(10, 10)
check.lesser_eq(10, 9)
end)
end)
test.suite("Boolean checks", function()
test.case("is_true", function()
check.is_true(false)
end)
test.case("is_false", function()
check.is_false(true)
end)
test.case("truthy", function()
check.truthy(nil)
end)
test.case("falsy", function()
check.falsy(10)
end)
end)
test.suite("Nil checks", function()
test.case("not nil", function()
local a = nil
check.not_nil(a)
end)
end)
end