diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2019-06-11 21:17:06 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2019-06-11 21:17:06 +0200 |
commit | 6704b66c33fa75b4b153cff809947489b267f2a8 (patch) | |
tree | d7fe843c326f37fb88c879e470326afaa3292229 | |
parent | 7f9b32e36a8fdfe3efdcdb05b84cafd297641d85 (diff) | |
download | pandoc-6704b66c33fa75b4b153cff809947489b267f2a8.tar.gz |
test/lua/module/pandoc.lua: fix non-determinism in test
-rw-r--r-- | test/lua/module/pandoc.lua | 15 |
1 files changed, 11 insertions, 4 deletions
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,16 +20,23 @@ 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), + 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( - pandoc.List:new(attr_from_list.attributes), + assoc_list_from_table, attributes_list ) end |