mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Add test for error global
This commit is contained in:
parent
2f3fb07b7c
commit
851589c695
2 changed files with 16 additions and 0 deletions
|
@ -81,6 +81,7 @@ create_tests! {
|
|||
global_g_table: "globals/_G",
|
||||
global_version: "globals/_VERSION",
|
||||
global_coroutine: "globals/coroutine",
|
||||
global_error: "globals/error",
|
||||
global_pcall: "globals/pcall",
|
||||
global_type: "globals/type",
|
||||
global_typeof: "globals/typeof",
|
||||
|
|
15
tests/globals/error.luau
Normal file
15
tests/globals/error.luau
Normal file
|
@ -0,0 +1,15 @@
|
|||
local errValue = newproxy(false)
|
||||
|
||||
local success, result = pcall(function()
|
||||
error({
|
||||
Inner = errValue,
|
||||
})
|
||||
end)
|
||||
|
||||
assert(not success, "Pcall succeeded when erorred")
|
||||
|
||||
assert(result ~= nil, "Pcall did not return error")
|
||||
assert(type(result) == "table", "Pcall error value should have been a table")
|
||||
|
||||
assert(result.Inner ~= nil, "Pcall error table should contain inner value")
|
||||
assert(result.Inner == errValue, "Pcall error table should have correct inner value")
|
Loading…
Reference in a new issue