aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-11-24 16:41:52 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2021-11-24 16:54:12 +0100
commita8638894ab698cc0e49757a2732e383b652834bc (patch)
treef002d8cdf3f40b5a7a450a0aa2cd0f16a06d491f /test
parent79e6f8db13ef8f0db6da8fe4e17b7626fe6ef3e9 (diff)
downloadpandoc-a8638894ab698cc0e49757a2732e383b652834bc.tar.gz
Lua: allow single elements as singleton MetaBlocks/MetaInlines
Single elements should always be treated as singleton lists in the Lua subsystem.
Diffstat (limited to 'test')
-rw-r--r--test/lua/module/pandoc.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/lua/module/pandoc.lua b/test/lua/module/pandoc.lua
index b191bcb3c..2849eedbf 100644
--- a/test/lua/module/pandoc.lua
+++ b/test/lua/module/pandoc.lua
@@ -735,7 +735,25 @@ return {
assert.are_equal((pandoc.MetaMap{}).tag, (pandoc.MetaMap{}).t)
assert.are_equal((pandoc.MetaInlines{}).tag, (pandoc.MetaInlines{}).t)
assert.are_equal((pandoc.MetaBlocks{}).tag, (pandoc.MetaBlocks{}).t)
- end)
+ end),
+ },
+ group 'Meta' {
+ test('inline list is treated as MetaInlines', function ()
+ local meta = pandoc.Pandoc({}, {test = {pandoc.Emph 'check'}}).meta
+ assert.are_same(meta.test, {pandoc.Emph{pandoc.Str 'check'}})
+ end),
+ test('inline element is treated as MetaInlines singleton', function ()
+ local meta = pandoc.Pandoc({}, {test = pandoc.Emph 'check'}).meta
+ assert.are_same(meta.test, {pandoc.Emph{pandoc.Str 'check'}})
+ end),
+ test('block list is treated as MetaBlocks', function ()
+ local meta = pandoc.Pandoc({}, {test = {pandoc.Plain 'check'}}).meta
+ assert.are_same(meta.test, {pandoc.Plain{pandoc.Str 'check'}})
+ end),
+ test('block element is treated as MetaBlocks singleton', function ()
+ local meta = pandoc.Pandoc({}, {test = pandoc.Plain 'check'}).meta
+ assert.are_same(meta.test, {pandoc.Plain{pandoc.Str 'check'}})
+ end),
},
group 'Other types' {
group 'Citation' {