-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharrays.luau
More file actions
43 lines (37 loc) · 1.38 KB
/
arrays.luau
File metadata and controls
43 lines (37 loc) · 1.38 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
local frktest = require("@frktest/frktest")
local test = frktest.test
local check = frktest.assert.check
return function()
test.suite("Arrays", function()
test.case("contains", function()
local a = { "one", "two", "three", "four", "five" }
check.array.contains(a, "eleven") -- check for one value
check.array.contains(a, { "four", "five", "six", "seven" }) -- check for multiple values
end)
test.case("equal changed", function()
local a = { 1, 2, 3, 4, 5 }
local b = { 1, 2, 10, 4, 5 }
check.array.equal(a, b)
end)
test.case("equal extra", function()
local a = { 1, 2, 3, 4, 5 }
local b = { 1, 2, 3, 4, 5, 6, 7 }
check.array.equal(a, b)
end)
test.case("equal fewer", function()
local a = { 1, 2, 3, 4, 5 }
local b = { 1, 2, 3 }
check.array.equal(a, b)
end)
test.case("equal changed and more", function()
local a = { 1, 2, 3, 4, 5 }
local b = { 1, 20, 3, 4, 5, 6, 7 }
check.array.equal(a, b)
end)
test.case("for arrays with tables, you should use check.table.equal", function()
local a = { { a = 1 }, { a = 2 } }
local b = { { a = 1 }, { a = 2 } }
check.array.equal(a, b)
end)
end)
end