mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 21:10:36 +00:00
18 lines
491 B
Lua
18 lines
491 B
Lua
|
local luau = require("@lune/luau")
|
||
|
|
||
|
local EMPTY_LUAU_CODE_BLOCK = "do end"
|
||
|
local BROKEN_LUAU_CODE_BLOCK = "do"
|
||
|
|
||
|
assert(type(luau.compile) == "function", "expected `luau.compile` to be a function")
|
||
|
|
||
|
assert(
|
||
|
type(luau.compile(EMPTY_LUAU_CODE_BLOCK)) == "string",
|
||
|
"expected `luau.compile` to return bytecode string"
|
||
|
)
|
||
|
|
||
|
local success = pcall(function()
|
||
|
luau.compile(BROKEN_LUAU_CODE_BLOCK)
|
||
|
end)
|
||
|
|
||
|
assert(success == false, "expected 'BROKEN_LUAU_CODE_BLOCK' to fail to compile into bytecode.")
|