Skip to content

Commit

Permalink
Update test.lua polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
rossnichols committed May 16, 2024
1 parent f8ec8b2 commit c3625fb
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions tests.lua
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
-- This library targets Lua 5.1. To run the tests using Lua 5.4, the following functions are needed.
unpack = unpack or table.unpack
math.frexp = frexp or function(num)
if num == math.huge then return num end
local fraction, exponent = num, 0
if fraction ~= 0 then
while fraction >= 1 do
fraction = fraction / 2
exponent = exponent + 1
end
while fraction < 0.5 do
fraction = fraction * 2
exponent = exponent - 1
end
end
return fraction, exponent
end
math.ldexp = math.ldexp or function(m, e)
return m * 2 ^ e
end

local LibSerialize = LibStub and LibStub:GetLibrary("LibSerialize") or require("LibSerialize")

local pairs = pairs
local type = type
local tostring = tostring
local assert = assert
-- Compatibility with Lua 5.4
local unpack = unpack or table.unpack
local pcall = pcall

function LibSerialize:RunTests()
--[[---------------------------------------------------------------------------
Expand Down

0 comments on commit c3625fb

Please sign in to comment.