mirror of
https://github.com/lune-org/lune.git
synced 2025-05-04 10:43:57 +01:00
feature: add test for '\0' byte when given invalid lua code
This commit is contained in:
parent
5a658d5966
commit
f86d829f32
1 changed files with 9 additions and 1 deletions
|
@ -1,8 +1,16 @@
|
|||
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("do end")) == "string",
|
||||
type(luau.compile(EMPTY_LUAU_CODE_BLOCK)) == "string",
|
||||
"expected `luau.compile` to return bytecode string"
|
||||
)
|
||||
|
||||
assert(
|
||||
string.byte(luau.compile(BROKEN_LUAU_CODE_BLOCK), 1, 1) == 0,
|
||||
"expected errors to return with \0 byte, error message attached afterwards."
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue