]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Fix selector tests to work with both LuaJIT and Lua 5.4
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 6 Dec 2025 08:49:57 +0000 (08:49 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 6 Dec 2025 08:49:57 +0000 (08:49 +0000)
Use tostring() for expected values so they match the runtime's
float-to-string conversion (LuaJIT: "1", Lua 5.4: "1.0")

test/lua/unit/selectors.lua

index 1266a90521e4ccb1a7bc9351c8b322d9e049642a..437014fe2f8fb640217c68389f78e7d956d9cd6e 100644 (file)
@@ -230,11 +230,11 @@ context("Selectors test", function()
 
     ["pool_var double"] = {
                 selector = [[pool_var("int_var", 'double')]],
-                expect = {"1.0"}},
+                expect = {tostring(1.0)}},
 
     ["time"] = {
                 selector = "time",
-                expect = {"1537364211.0"}},
+                expect = {tostring(1537364211.0)}},
 
 --    ["request_header"] = {
 --                selector = "request_header(hdr1)",