Add utils.OrderedTable, make test order consistent
Also added OrderedTable tests and comment support to expect.*()develop
parent
0128bc39db
commit
163c9b4059
@ -0,0 +1,15 @@
|
|||||||
|
local utils = require 'utils'
|
||||||
|
|
||||||
|
function test.OrderedTable()
|
||||||
|
local t = utils.OrderedTable()
|
||||||
|
local keys = {'a', 'c', 'e', 'd', 'b', 'q', 58, -1.2}
|
||||||
|
for i = 1, #keys do
|
||||||
|
t[keys[i]] = i
|
||||||
|
end
|
||||||
|
local i = 1
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
expect.eq(k, keys[i], 'key order')
|
||||||
|
expect.eq(v, i, 'correct value')
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue