diff --git a/src/tests.rs b/src/tests.rs index 2d59658..9db8368 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -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", diff --git a/tests/globals/error.luau b/tests/globals/error.luau new file mode 100644 index 0000000..903bf34 --- /dev/null +++ b/tests/globals/error.luau @@ -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")