diff --git a/test/lua/module/pandoc.lua b/test/lua/module/pandoc.lua index 1ecd1f609..1c02c8720 100644 --- a/test/lua/module/pandoc.lua +++ b/test/lua/module/pandoc.lua @@ -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 ) },