From c9ab933a23afce01eab31a450ca0eab9bdf43014 Mon Sep 17 00:00:00 2001 From: Kenneth Loeffler Date: Wed, 16 Aug 2023 16:47:04 -0700 Subject: [PATCH] Update rbx_dom_lua to rojo-rbx/rbx-dom@7b03132 (#775) Fixes a problem where the MaterialColors Lua encoder would return nothing --- plugin/rbx_dom_lua/EncodedValue.lua | 1 + plugin/rbx_dom_lua/EncodedValue.spec.lua | 27 ++++++++++-------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plugin/rbx_dom_lua/EncodedValue.lua b/plugin/rbx_dom_lua/EncodedValue.lua index 16dde4895..35417410a 100644 --- a/plugin/rbx_dom_lua/EncodedValue.lua +++ b/plugin/rbx_dom_lua/EncodedValue.lua @@ -282,6 +282,7 @@ types = { math.round(math.clamp(color.B, 0, 1) * 255) } end + return pod end, }, diff --git a/plugin/rbx_dom_lua/EncodedValue.spec.lua b/plugin/rbx_dom_lua/EncodedValue.spec.lua index cf0b22016..14522ae84 100644 --- a/plugin/rbx_dom_lua/EncodedValue.spec.lua +++ b/plugin/rbx_dom_lua/EncodedValue.spec.lua @@ -1,6 +1,6 @@ return function() local HttpService = game:GetService("HttpService") - + local EncodedValue = require(script.Parent.EncodedValue) local allValues = require(script.Parent.allValues) @@ -13,16 +13,16 @@ return function() if ty == "table" then local visited = {} - - for key, valueA in pairs(a) do + + for key, valueA in a do visited[key] = true - + if not deepEq(valueA, b[key]) then return false end end - for key, valueB in pairs(b) do + for key, valueB in b do if visited[key] then continue end @@ -44,28 +44,23 @@ return function() end, } - for testName, testEntry in pairs(allValues) do + for testName, testEntry in allValues do it("round trip " .. testName, function() - local ok, decoded = EncodedValue.decode(testEntry.value) - assert(ok, decoded) + local decodeOk, decoded = EncodedValue.decode(testEntry.value) + assert(decodeOk, decoded) if extraAssertions[testName] ~= nil then extraAssertions[testName](decoded) end - local ok, encoded = EncodedValue.encode(decoded, testEntry.ty) - assert(ok, encoded) + local encodeOk, encoded = EncodedValue.encode(decoded, testEntry.ty) + assert(encodeOk, encoded) if not deepEq(encoded, testEntry.value) then local expected = HttpService:JSONEncode(testEntry.value) local actual = HttpService:JSONEncode(encoded) - local message = string.format( - "Round-trip results did not match.\nExpected:\n%s\nActual:\n%s", - expected, actual - ) - - error(message) + error(`Round-trip results did not match.\nExpected:\n{expected}\nActual:\n{actual}`) end end) end