forked from luau-lang/lute
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.test.luau
More file actions
35 lines (29 loc) · 870 Bytes
/
check.test.luau
File metadata and controls
35 lines (29 loc) · 870 Bytes
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
local fs = require("@std/fs")
local path = require("@std/path")
local process = require("@std/process")
local system = require("@std/system")
local test = require("@std/test")
local lutePath = path.format(process.execpath())
local tmpDir = system.tmpdir()
test.suite("lute check", function(suite)
suite:case("uses new solver", function(assert)
local testFilePath = path.format(path.join(tmpDir, "check_new_solver.luau"))
fs.writestringtofile(
testFilePath,
[[
function add(a,b)
return a + b
end
local vec2 = {}
function vec2.new(x, y)
return setmetatable({x = x or 0, y = y or 0}, {__add = function(v1, v2) return {x = v1.x + v2.x, y = v1.y + v2.y} end})
end
add(1,1)
add(vec2.new(0, 0), vec2.new(1,1))
]]
)
local result = process.run({ lutePath, "check", testFilePath })
assert.eq(result.exitcode, 0)
fs.remove(testFilePath)
end)
end)