Software /
code /
prosody
Comparison
spec/util_array_spec.lua @ 10590:257dc26e8e65
util.array: Add a test case for a behavior change in Lua 5.3
In Lua 5.1 and 5.2 the __eq metamethod is not invoked if the other
argument is of a different metatable, but in Lua 5.3 it is.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 14 Jan 2020 23:39:47 +0100 |
parent | 10397:921e8b00778e |
child | 11787:3ae6fa901a8b |
comparison
equal
deleted
inserted
replaced
10589:3540118699cf | 10590:257dc26e8e65 |
---|---|
41 local a1 = array({ "a", "b" }); | 41 local a1 = array({ "a", "b" }); |
42 local a2 = array({ "a", "b" }); | 42 local a2 = array({ "a", "b" }); |
43 local b = array({ "c", "d" }); | 43 local b = array({ "c", "d" }); |
44 assert.truthy(a1 == a2); | 44 assert.truthy(a1 == a2); |
45 assert.falsy(a1 == b); | 45 assert.falsy(a1 == b); |
46 assert.falsy(a1 == { "a", "b" }, "Behavior of metatables changed in Lua 5.3"); | |
46 end); | 47 end); |
47 end); | 48 end); |
48 | 49 |
49 describe("division", function () | 50 describe("division", function () |
50 it("works", function () | 51 it("works", function () |