test/lua/module/pandoc.lua: fix non-determinism in test
This commit is contained in:
parent
7f9b32e36a
commit
6704b66c33
1 changed files with 13 additions and 6 deletions
|
@ -20,18 +20,25 @@ return {
|
|||
test(
|
||||
'accepts string-indexed table or list of pairs as attributes',
|
||||
function ()
|
||||
local attributes_table = {one = '1', two = '2'}
|
||||
local attributes_list = pandoc.List:new {{'one', '1'}, {'two', '2'}}
|
||||
local attr_from_table = pandoc.Attr('', {}, attributes_table)
|
||||
local attr_from_list = pandoc.Attr('', {}, attributes_list:clone())
|
||||
assert.are_same(
|
||||
pandoc.List:new(attr_from_table.attributes),
|
||||
attributes_list
|
||||
)
|
||||
|
||||
assert.are_same(
|
||||
pandoc.List:new(attr_from_list.attributes),
|
||||
attributes_list
|
||||
)
|
||||
|
||||
local attributes_table = {one = '1', two = '2'}
|
||||
local attr_from_table = pandoc.Attr('', {}, attributes_table)
|
||||
|
||||
local assoc_list_from_table =
|
||||
pandoc.List:new(attr_from_table.attributes)
|
||||
-- won't work in general, but does in this special case
|
||||
table.sort(assoc_list_from_table, function(x, y) return x[1]<y[1] end)
|
||||
assert.are_same(
|
||||
assoc_list_from_table,
|
||||
attributes_list
|
||||
)
|
||||
end
|
||||
)
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue