From a66d54c6f16f26999f4dca111b5197fddd696744 Mon Sep 17 00:00:00 2001 From: Andrew D. France Date: Wed, 23 Jul 2025 00:19:04 -0500 Subject: Removed the problematic _ENV;compat53 DOES NOT provide lexical scoping with _ENV: ln:25-64 --- Jenkinsfile | 60 +++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 122424f..3293c99 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,27 +24,45 @@ pipeline { echo 'Creating test script on Jenkins agent...' sh ''' cat <<'EOF' > test_52.lua - -- Lua 5.2-specific features - print("--- Running Lua 5.2 Compatibility Test ---") - local _ENV = { print = print, x = 123 } -- lexical environments - function show_x() - print("x =", x) - end - show_x() - -- Bitwise ops (using the bit32 library provided by compat53) - local bit32 = require("bit32") - local a, b = 0x5, 0x3 - print("Bitwise AND:", bit32.band(a, b)) - -- load() replaces loadstring() (binary and text) - local f = load("return 10 + 20") - print("Loaded result:", f()) - -- table.pack / table.unpack - local t = table.pack(1, 2, 3, nil, 5) - print("Packed length:", t.n) - print("Unpacked values:", table.unpack(t, 1, t.n)) - print("--- Test Complete ---") - EOF +-- Lua 5.2-specific features test +print("--- Running Lua 5.2 Compatibility Test ---") + +-- Test 1: Basic functionality +print("Basic print test: Hello from Lush!") + +-- Test 2: Bitwise operations using bit32 library (provided by compat53) +local bit32 = require("bit32") +local a, b = 0x5, 0x3 +print("Bitwise AND of", a, "and", b, "=", bit32.band(a, b)) +print("Bitwise OR of", a, "and", b, "=", bit32.bor(a, b)) + +-- Test 3: load() function (replaces loadstring in Lua 5.2) +local f = load("return 10 + 20") +if f then + print("Loaded function result:", f()) +else + print("Failed to load function") +end + +-- Test 4: table.pack and table.unpack +local t = table.pack(1, 2, 3, nil, 5) +print("Packed table length:", t.n) +print("First 3 values:", table.unpack(t, 1, 3)) + +-- Test 5: String operations +local str = "Hello, World!" +print("String length:", #str) +print("Substring:", string.sub(str, 1, 5)) + +-- Test 6: Math operations +print("Math operations:") +print(" sqrt(16) =", math.sqrt(16)) +print(" max(10, 20, 5) =", math.max(10, 20, 5)) + +print("--- Test Complete: All basic features working ---") +EOF ''' + echo 'Creating and starting the build container...' // Create the container and keep it running in the background sh "docker run -d --name ${containerName} lush-app:latest sleep infinity" @@ -75,4 +93,4 @@ pipeline { sh 'docker rmi lush-app:latest || true' } } -} +} \ No newline at end of file -- cgit v1.2.3-59-g8ed1b