mirror of
https://github.com/bjc/prosody.git
synced 2025-04-01 20:27:39 +03:00
util.json: Test util.array integration
This is to expose how [] == json.null due to a change in Lua 5.3 with how the equality metamethod is chosen.
This commit is contained in:
parent
a0bb180c36
commit
f38173be79
1 changed files with 10 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
|
||||
local json = require "util.json";
|
||||
local array = require "util.array";
|
||||
|
||||
describe("util.json", function()
|
||||
describe("#encode()", function()
|
||||
|
@ -67,4 +68,13 @@ describe("util.json", function()
|
|||
end
|
||||
end);
|
||||
end)
|
||||
|
||||
describe("util.array integration", function ()
|
||||
it("works", function ()
|
||||
assert.equal("[]", json.encode(array()));
|
||||
assert.equal("[1,2,3]", json.encode(array({1,2,3})));
|
||||
assert.equal(getmetatable(array()), getmetatable(json.decode("[]")));
|
||||
end);
|
||||
end);
|
||||
|
||||
end);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue