From 6704b66c33fa75b4b153cff809947489b267f2a8 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 11 Jun 2019 21:17:06 +0200 Subject: test/lua/module/pandoc.lua: fix non-determinism in test --- test/lua/module/pandoc.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test') 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]