aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-12-21 17:12:56 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2021-12-21 19:00:21 +0100
commit1c389bf6b6236cefcadac3c2eefe62eb6c884863 (patch)
tree2b623d04faef769bda946aeaaf45ebaa0b9af833
parent8734057dff33cbfad45c81847a1efd371380d5c4 (diff)
downloadpandoc-1c389bf6b6236cefcadac3c2eefe62eb6c884863.tar.gz
Lua: add tests for pandoc.utils.equals
-rw-r--r--test/lua/module/pandoc-utils.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lua/module/pandoc-utils.lua b/test/lua/module/pandoc-utils.lua
index 104adfe4c..db363ebe6 100644
--- a/test/lua/module/pandoc-utils.lua
+++ b/test/lua/module/pandoc-utils.lua
@@ -39,6 +39,46 @@ return {
end)
},
+ group 'equals' {
+ test('compares Pandoc elements', function ()
+ assert.is_truthy(
+ utils.equals(pandoc.Pandoc{'foo'}, pandoc.Pandoc{'foo'})
+ )
+ end),
+ test('compares Block elements', function ()
+ assert.is_truthy(
+ utils.equals(pandoc.Plain{'foo'}, pandoc.Plain{'foo'})
+ )
+ assert.is_falsy(
+ utils.equals(pandoc.Para{'foo'}, pandoc.Plain{'foo'})
+ )
+ end),
+ test('compares Inline elements', function ()
+ assert.is_truthy(
+ utils.equals(pandoc.Emph{'foo'}, pandoc.Emph{'foo'})
+ )
+ assert.is_falsy(
+ utils.equals(pandoc.Emph{'foo'}, pandoc.Strong{'foo'})
+ )
+ end),
+ test('compares Inline with Block elements', function ()
+ assert.is_falsy(
+ utils.equals(pandoc.Emph{'foo'}, pandoc.Plain{'foo'})
+ )
+ assert.is_falsy(
+ utils.equals(pandoc.Para{'foo'}, pandoc.Strong{'foo'})
+ )
+ end),
+ test('compares Pandoc with Block elements', function ()
+ assert.is_falsy(
+ utils.equals(pandoc.Pandoc{'foo'}, pandoc.Plain{'foo'})
+ )
+ assert.is_falsy(
+ utils.equals(pandoc.Para{'foo'}, pandoc.Pandoc{'foo'})
+ )
+ end),
+ },
+
group 'make_sections' {
test('sanity check', function ()
local blks = {