fix(test): fix strings_spec.lua for AArch64

LuaJIT does not handle -0.0 correctly in 'dual number mode' (which is
the default, and only supported mode for LuaJIT arm64). If LuaJIT is
forced to use 'dual number mode' on X64 (where the default is single),
this test will fail in the same manner.

Fix this by using tonumber("-0.0") instead of a -0.0 literal.

See: https://github.com/LuaJIT/LuaJIT/issues/858
This commit is contained in:
Joey Gouly 2024-04-12 17:24:11 +01:00
parent 4459e0cee8
commit f4c97da262

View File

@ -188,7 +188,7 @@ describe('vim_snprintf()', function()
a('nan', buf, bsize, '%f', 0.0 / 0.0)
a('inf', buf, bsize, '%f', 1.0 / 0.0)
a('-inf', buf, bsize, '%f', -1.0 / 0.0)
a('-0.000000', buf, bsize, '%f', -0.0)
a('-0.000000', buf, bsize, '%f', tonumber('-0.0'))
a('漢語', buf, bsize, '%s', '漢語')
a(' 漢語', buf, bsize, '%8s', '漢語')
a('漢語 ', buf, bsize, '%-8s', '漢語')
@ -233,7 +233,7 @@ describe('vim_snprintf()', function()
a('nan', buf, bsize, '%1$f', 0.0 / 0.0)
a('inf', buf, bsize, '%1$f', 1.0 / 0.0)
a('-inf', buf, bsize, '%1$f', -1.0 / 0.0)
a('-0.000000', buf, bsize, '%1$f', -0.0)
a('-0.000000', buf, bsize, '%1$f', tonumber('-0.0'))
end
end)