From 3dc6ad3cf5c20001e1ef61d923cb95617356a557 Mon Sep 17 00:00:00 2001 From: Reuh Date: Fri, 26 Dec 2025 15:48:21 +0100 Subject: [PATCH] fix: fix Lua 5.5 tests --- test/test.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/test.lua b/test/test.lua index 30fc457..5ce0830 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1157,20 +1157,21 @@ foo = 12 ]]) if _VERSION >= "Lua 5.5" then test("global variable declaration", [[ - do - global foo - global bar - end - foo = 42 - assert(not pcall(function() foo = 42 end)) + global foo = 42 ]]) + test("global variable declaration with error", [[ + global foo = 42 + bar = 12 + ]], { "loadError", "variable 'bar' not declared" }) + test("global variable declaration with attribute", [[ + global bar + bar = 42 + ]], { "loadError", "attempt to assign to const variable 'bar'" }) test("collective global variable declaration with attribute", [[ foo = 42 - do - global * - end - assert(not pcall(function() foo = 12 end)) - ]]) + global * + foo = 12 + ]], { "loadError", "attempt to assign to const variable 'foo'" }) end -- bitwise operators