diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2021-12-21 17:12:56 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2021-12-21 19:00:21 +0100 |
commit | 1c389bf6b6236cefcadac3c2eefe62eb6c884863 (patch) | |
tree | 2b623d04faef769bda946aeaaf45ebaa0b9af833 /test | |
parent | 8734057dff33cbfad45c81847a1efd371380d5c4 (diff) | |
download | pandoc-1c389bf6b6236cefcadac3c2eefe62eb6c884863.tar.gz |
Lua: add tests for pandoc.utils.equals
Diffstat (limited to 'test')
-rw-r--r-- | test/lua/module/pandoc-utils.lua | 40 |
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 = { |