aboutsummaryrefslogtreecommitdiff
path: root/test/lua
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2021-12-29 15:00:59 +0200
committerIgor Pashev <pashev.igor@gmail.com>2021-12-29 15:00:59 +0200
commitb4361712899fd0183fea5513180cb383979616de (patch)
tree688ab7ee2ab3a8cd32b4e37b506099aec95388f7 /test/lua
parent726ad97faebe59e024d68d293e663c02bbe423c8 (diff)
parentd960282b105a6469c760b4308a3b81da723b7256 (diff)
downloadpandoc-b4361712899fd0183fea5513180cb383979616de.tar.gz
Merge https://github.com/jgm/pandoc
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/implicit-doc-filter.lua2
-rw-r--r--test/lua/module/pandoc-types.lua25
-rw-r--r--test/lua/module/pandoc-utils.lua184
-rw-r--r--test/lua/module/pandoc.lua323
4 files changed, 389 insertions, 145 deletions
diff --git a/test/lua/implicit-doc-filter.lua b/test/lua/implicit-doc-filter.lua
index 253462d1c..f053dc1b2 100644
--- a/test/lua/implicit-doc-filter.lua
+++ b/test/lua/implicit-doc-filter.lua
@@ -1,4 +1,4 @@
-function Doc (doc)
+function Pandoc (doc)
local meta = {}
local hello = { pandoc.Str "Hello,", pandoc.Space(), pandoc.Str "World!" }
local blocks = { pandoc.Para(hello) }
diff --git a/test/lua/module/pandoc-types.lua b/test/lua/module/pandoc-types.lua
index d4e063a5c..d9c9f82ac 100644
--- a/test/lua/module/pandoc-types.lua
+++ b/test/lua/module/pandoc-types.lua
@@ -55,31 +55,6 @@ return {
end),
},
- group 'list-like behavior' {
- test('can access version component numbers', function ()
- local version = Version '2.7.3'
- assert.is_nil(version[0])
- assert.are_equal(version[1], 2)
- assert.are_equal(version[2], 7)
- assert.are_equal(version[3], 3)
- end),
- test('can be iterated over', function ()
- local version_list = {2, 7, 3}
- local final_index = 0
- for i, v in pairs(Version(version_list)) do
- assert.are_equal(v, version_list[i])
- final_index = i
- end
- assert.are_equal(final_index, 3)
- end),
- test('length is the number of components', function ()
- assert.are_equal(#(Version '0'), 1)
- assert.are_equal(#(Version '1.6'), 2)
- assert.are_equal(#(Version '8.7.5'), 3)
- assert.are_equal(#(Version '2.9.1.5'), 4)
- end)
- },
-
group 'conversion to string' {
test('converting from and to string is a noop', function ()
local version_string = '1.19.4'
diff --git a/test/lua/module/pandoc-utils.lua b/test/lua/module/pandoc-utils.lua
index 9bd903f2d..4cf2c84a7 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 = {
@@ -62,6 +102,31 @@ return {
end),
},
+ group 'references' {
+ test('gets references from doc', function ()
+ local ref = {
+ ['author'] = {
+ {given = 'Max', family = 'Mustermann'}
+ },
+ ['container-title'] = pandoc.Inlines('JOSS'),
+ ['id'] = 'test',
+ ['issued'] = {['date-parts'] = {{2021}}},
+ ['title'] = pandoc.Inlines{
+ pandoc.Quoted('DoubleQuote', 'Interesting'),
+ pandoc.Space(),
+ 'work'
+ },
+ ['type'] = 'article-journal',
+ }
+ local nocite = pandoc.Cite(
+ '@test',
+ {pandoc.Citation('test', 'NormalCitation')}
+ )
+ local doc = pandoc.Pandoc({}, {nocite = nocite, references = {ref}})
+ assert.are_same({ref}, pandoc.utils.references(doc))
+ end)
+ },
+
group 'sha1' {
test('hashing', function ()
local ref_hash = '0a0a9f2a6772942557ab5355d76af442f8f65e01'
@@ -70,7 +135,7 @@ return {
},
group 'stringify' {
- test('inlines', function ()
+ test('Inline', function ()
local inline = pandoc.Emph{
pandoc.Str 'Cogito',
pandoc.Space(),
@@ -79,7 +144,49 @@ return {
pandoc.Str 'sum.',
}
assert.are_equal('Cogito ergo sum.', utils.stringify(inline))
- end)
+ end),
+ test('Block', function ()
+ local block = pandoc.Para{
+ pandoc.Str 'Make',
+ pandoc.Space(),
+ pandoc.Str 'it',
+ pandoc.Space(),
+ pandoc.Str 'so.',
+ }
+ assert.are_equal('Make it so.', utils.stringify(block))
+ end),
+ test('boolean', function ()
+ assert.are_equal('true', utils.stringify(true))
+ assert.are_equal('false', utils.stringify(false))
+ end),
+ test('number', function ()
+ assert.are_equal('5', utils.stringify(5))
+ assert.are_equal('23.23', utils.stringify(23.23))
+ end),
+ test('Attr', function ()
+ local attr = pandoc.Attr('foo', {'bar'}, {a = 'b'})
+ assert.are_equal('', utils.stringify(attr))
+ end),
+ test('List', function ()
+ local list = pandoc.List{pandoc.Str 'a', pandoc.Blocks('b')}
+ assert.are_equal('ab', utils.stringify(list))
+ end),
+ test('Blocks', function ()
+ local blocks = pandoc.Blocks{pandoc.Para 'a', pandoc.Header(1, 'b')}
+ assert.are_equal('ab', utils.stringify(blocks))
+ end),
+ test('Inlines', function ()
+ local inlines = pandoc.Inlines{pandoc.Str 'a', pandoc.Subscript('b')}
+ assert.are_equal('ab', utils.stringify(inlines))
+ end),
+ test('Meta', function ()
+ local meta = pandoc.Meta{
+ a = pandoc.Inlines 'funny and ',
+ b = 'good movie',
+ c = pandoc.List{pandoc.Inlines{pandoc.Str '!'}}
+ }
+ assert.are_equal('funny and good movie!', utils.stringify(meta))
+ end),
},
group 'to_roman_numeral' {
@@ -91,6 +198,46 @@ return {
end)
},
+ group 'type' {
+ test('nil', function ()
+ assert.are_equal(utils.type(nil), 'nil')
+ end),
+ test('boolean', function ()
+ assert.are_equal(utils.type(true), 'boolean')
+ assert.are_equal(utils.type(false), 'boolean')
+ end),
+ test('number', function ()
+ assert.are_equal(utils.type(5), 'number')
+ assert.are_equal(utils.type(-3.02), 'number')
+ end),
+ test('string', function ()
+ assert.are_equal(utils.type(''), 'string')
+ assert.are_equal(utils.type('asdf'), 'string')
+ end),
+ test('plain table', function ()
+ assert.are_equal(utils.type({}), 'table')
+ end),
+ test('List', function ()
+ assert.are_equal(utils.type(pandoc.List{}), 'List')
+ end),
+ test('Inline', function ()
+ assert.are_equal(utils.type(pandoc.Str 'a'), 'Inline')
+ assert.are_equal(utils.type(pandoc.Emph 'emphasized'), 'Inline')
+ end),
+ test('Inlines', function ()
+ assert.are_equal(utils.type(pandoc.Inlines{pandoc.Str 'a'}), 'Inlines')
+ assert.are_equal(utils.type(pandoc.Inlines{pandoc.Emph 'b'}), 'Inlines')
+ end),
+ test('Blocks', function ()
+ assert.are_equal(utils.type(pandoc.Para 'a'), 'Block')
+ assert.are_equal(utils.type(pandoc.CodeBlock 'true'), 'Block')
+ end),
+ test('Inlines', function ()
+ assert.are_equal(utils.type(pandoc.Blocks{'a'}), 'Blocks')
+ assert.are_equal(utils.type(pandoc.Blocks{pandoc.CodeBlock 'b'}), 'Blocks')
+ end),
+ },
+
group 'to_simple_table' {
test('convertes Table', function ()
function simple_cell (blocks)
@@ -106,14 +253,14 @@ return {
{long = {pandoc.Plain {
pandoc.Str "the", pandoc.Space(), pandoc.Str "caption"}}},
{{pandoc.AlignDefault, nil}},
- {pandoc.Attr(), {{pandoc.Attr(), {simple_cell{pandoc.Plain "head1"}}}}},
+ pandoc.TableHead{pandoc.Row{simple_cell{pandoc.Plain "head1"}}},
{{
attr = pandoc.Attr(),
- body = {{pandoc.Attr(), {simple_cell{pandoc.Plain "cell1"}}}},
+ body = {pandoc.Row{simple_cell{pandoc.Plain "cell1"}}},
head = {},
row_head_columns = 0
}},
- {pandoc.Attr(), {}},
+ pandoc.TableFoot(),
pandoc.Attr()
)
local stbl = utils.to_simple_table(tbl)
@@ -155,5 +302,32 @@ return {
-- reversible
assert.are_same(simple_table, utils.to_simple_table(tbl))
end),
+ test('empty caption', function ()
+ local simple_table = pandoc.SimpleTable(
+ {},
+ {pandoc.AlignDefault},
+ {0},
+ {{pandoc.Plain 'a'}},
+ {{{pandoc.Plain 'b'}}}
+ )
+ local tbl = utils.from_simple_table(simple_table)
+ assert.are_equal(
+ pandoc.Blocks{},
+ tbl.caption.long
+ )
+ assert.is_nil(tbl.caption.short)
+ end),
+ test('empty body', function ()
+ local simple_table = pandoc.SimpleTable(
+ pandoc.Inlines('a nice caption'),
+ {pandoc.AlignDefault},
+ {0},
+ {{pandoc.Plain 'a'}},
+ {}
+ )
+ local tbl = utils.from_simple_table(simple_table)
+ tbl.bodies:map(print)
+ assert.are_same(pandoc.List(), tbl.bodies)
+ end),
}
}
diff --git a/test/lua/module/pandoc.lua b/test/lua/module/pandoc.lua
index fa1748c18..892ffee03 100644
--- a/test/lua/module/pandoc.lua
+++ b/test/lua/module/pandoc.lua
@@ -8,126 +8,182 @@ function os_is_windows ()
return package.config:sub(1,1) == '\\'
end
+-- Constructor behavior is tested in the hslua-pandoc-types module, so
+-- we just make sure the functions are present.
return {
- group 'Attr' {
- group 'Constructor' {
- test('returns null-Attr if no arguments are given', function ()
- local attr = pandoc.Attr()
- assert.are_equal(attr.identifier, '')
- assert.are_same(attr.classes, {})
- assert.are_same(attr.attributes, {})
- end),
- test(
- 'accepts string-indexed table or list of pairs as attributes',
- function ()
- local attributes_list = pandoc.List:new {{'one', '1'}, {'two', '2'}}
- local attr_from_list = pandoc.Attr('', {}, attributes_list:clone())
-
- assert.are_same(
- 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(
- assoc_list_from_table,
- attributes_list
- )
- end
- )
+ group 'Constructors' {
+ group 'Misc' {
+ test('pandoc.Attr is a function', function ()
+ assert.are_equal(type(pandoc.Attr), 'function')
+ end),
+ test('pandoc.AttributeList is a function', function ()
+ assert.are_equal(type(pandoc.AttributeList), 'function')
+ end),
+ test('pandoc.Blocks is a function', function ()
+ assert.are_equal(type(pandoc.Blocks), 'function')
+ end),
+ test('pandoc.Citation is a function', function ()
+ assert.are_equal(type(pandoc.Citation), 'function')
+ end),
+ test('pandoc.Inlines is a function', function ()
+ assert.are_equal(type(pandoc.Inlines), 'function')
+ end),
+ test('pandoc.SimpleTable is a function', function ()
+ assert.are_equal(type(pandoc.SimpleTable), 'function')
+ end),
+ test('pandoc.Meta is a function', function ()
+ assert.are_equal(type(pandoc.Meta), 'function')
+ end),
+ test('pandoc.Pandoc is a function', function ()
+ assert.are_equal(type(pandoc.Pandoc), 'function')
+ end),
},
- group 'AttributeList' {
- test('allows access via fields', function ()
- local attributes = pandoc.Attr('', {}, {{'a', '1'}, {'b', '2'}}).attributes
- assert.are_equal(attributes.a, '1')
- assert.are_equal(attributes.b, '2')
- end),
- test('allows access to pairs via numerical indexing', function ()
- local attributes = pandoc.Attr('', {}, {{'a', '1'}, {'b', '2'}}).attributes
- assert.are_same(attributes[1], {'a', '1'})
- assert.are_same(attributes[2], {'b', '2'})
- end),
- test('adds entries by field name', function ()
- local attributes = pandoc.Attr('',{}, {{'c', '1'}, {'d', '2'}}).attributes
- attributes.e = '3'
- assert.are_same(
- -- checking the full AttributeList would "duplicate" entries
- setmetatable(attributes, nil),
- {{'c', '1'}, {'d', '2'}, {'e', '3'}}
- )
+ group "Inline elements" {
+ test('pandoc.AttributeList is a function', function ()
+ assert.are_equal(type(pandoc.Cite), 'function')
+ end),
+ test('pandoc.AttributeList is a function', function ()
+ assert.are_equal(type(pandoc.Code), 'function')
+ end),
+ test('pandoc.Emph is a function', function ()
+ assert.are_equal(type(pandoc.Emph), 'function')
+ end),
+ test('pandoc.Image is a function', function ()
+ assert.are_equal(type(pandoc.Image), 'function')
+ end),
+ test('pandoc.Link is a function', function ()
+ assert.are_equal(type(pandoc.Link), 'function')
+ end),
+ test('pandoc.Math is a function', function ()
+ assert.are_equal(type(pandoc.Math), 'function')
+ end),
+ test('pandoc.Note is a function', function ()
+ assert.are_equal(type(pandoc.Note), 'function')
+ end),
+ test('pandoc.Quoted is a function', function ()
+ assert.are_equal(type(pandoc.Quoted), 'function')
+ end),
+ test('pandoc.SmallCaps is a function', function ()
+ assert.are_equal(type(pandoc.SmallCaps), 'function')
+ end),
+ test('pandoc.SoftBreak is a function', function ()
+ assert.are_equal(type(pandoc.SoftBreak), 'function')
+ end),
+ test('pandoc.Span is a function', function ()
+ assert.are_equal(type(pandoc.Span), 'function')
+ end),
+ test('pandoc.Str is a function', function ()
+ assert.are_equal(type(pandoc.Str), 'function')
+ end),
+ test('pandoc.Strikeout is a function', function ()
+ assert.are_equal(type(pandoc.Strikeout), 'function')
+ end),
+ test('pandoc.Strong is a function', function ()
+ assert.are_equal(type(pandoc.Strong), 'function')
+ end),
+ test('pandoc.Subscript is a function', function ()
+ assert.are_equal(type(pandoc.Subscript), 'function')
+ end),
+ test('pandoc.Superscript is a function', function ()
+ assert.are_equal(type(pandoc.Superscript), 'function')
+ end),
+ test('pandoc.Underline is a function', function ()
+ assert.are_equal(type(pandoc.Underline), 'function')
end),
- test('deletes entries by field name', function ()
- local attributes = pandoc.Attr('',{}, {a = '1', b = '2'}).attributes
- attributes.a = nil
- assert.is_nil(attributes.a)
- local assoc_list = setmetatable(attributes, nil)
- assert.are_same(assoc_list, {{'b', '2'}})
- end),
- test('remains unchanged if deleted key did not exist', function ()
- local assoc_list = pandoc.List:new {{'alpha', 'x'}, {'beta', 'y'}}
- local attributes = pandoc.Attr('', {}, assoc_list:clone()).attributes
- attributes.a = nil
- assert.are_same(pandoc.List:new(attributes), assoc_list)
- end),
- test('gives key-value pairs when iterated-over', function ()
- local attributes = {width = '11', height = '22', name = 'test'}
- local attr = pandoc.Attr('', {}, attributes)
- local count = 0
- for k, v in pairs(attr.attributes) do
- assert.are_equal(attributes[k], v)
- count = count + 1
- end
- assert.are_equal(count, 3)
- end)
},
- group 'HTML-like attribute tables' {
- test('in element constructor', function ()
- local html_attributes = {
- id = 'the-id',
- class = 'class1 class2',
- width = '11',
- height = '12'
- }
- local attr = pandoc.Span('test', html_attributes).attr
- assert.are_equal(attr.identifier, 'the-id')
- assert.are_equal(attr.classes[1], 'class1')
- assert.are_equal(attr.classes[2], 'class2')
- assert.are_equal(attr.attributes.width, '11')
- assert.are_equal(attr.attributes.height, '12')
- end),
- test('element attr setter', function ()
- local html_attributes = {
- id = 'the-id',
- class = 'class1 class2',
- width = "11",
- height = "12"
- }
- local span = pandoc.Span 'test'
- span.attr = html_attributes
- assert.are_equal(span.attr.identifier, 'the-id')
- assert.are_equal(span.attr.classes[1], 'class1')
- assert.are_equal(span.attr.classes[2], 'class2')
- assert.are_equal(span.attr.attributes.width, '11')
- assert.are_equal(span.attr.attributes.height, '12')
- end),
- test('element attrbutes setter', function ()
- local attributes = {
- width = "11",
- height = "12"
- }
- local span = pandoc.Span 'test'
- span.attributes = attributes
- assert.are_equal(span.attr.attributes.width, '11')
- assert.are_equal(span.attr.attributes.height, '12')
- end)
+ group "Block elements" {
+ test('pandoc.BlockQuote is a function', function ()
+ assert.are_equal(type(pandoc.BlockQuote), 'function')
+ end),
+ test('pandoc.BulletList is a function', function ()
+ assert.are_equal(type(pandoc.BulletList), 'function')
+ end),
+ test('pandoc.CodeBlock is a function', function ()
+ assert.are_equal(type(pandoc.CodeBlock), 'function')
+ end),
+ test('pandoc.DefinitionList is a function', function ()
+ assert.are_equal(type(pandoc.DefinitionList), 'function')
+ end),
+ test('pandoc.Div is a function', function ()
+ assert.are_equal(type(pandoc.Div), 'function')
+ end),
+ test('pandoc.Header is a function', function ()
+ assert.are_equal(type(pandoc.Header), 'function')
+ end),
+ test('pandoc.LineBlock is a function', function ()
+ assert.are_equal(type(pandoc.LineBlock), 'function')
+ end),
+ test('pandoc.Null is a function', function ()
+ assert.are_equal(type(pandoc.Null), 'function')
+ end),
+ test('pandoc.OrderedList is a function', function ()
+ assert.are_equal(type(pandoc.OrderedList), 'function')
+ end),
+ test('pandoc.Para is a function', function ()
+ assert.are_equal(type(pandoc.Para), 'function')
+ end),
+ test('pandoc.Plain is a function', function ()
+ assert.are_equal(type(pandoc.Plain), 'function')
+ end),
+ test('pandoc.RawBlock is a function', function ()
+ assert.are_equal(type(pandoc.Plain), 'function')
+ end),
+ test('pandoc.Table is a function', function ()
+ assert.are_equal(type(pandoc.Table), 'function')
+ end),
}
},
+ group 'MetaValue elements' {
+ test('MetaList elements behave like lists', function ()
+ local metalist = pandoc.MetaList{}
+ assert.are_equal(type(metalist.insert), 'function')
+ assert.are_equal(type(metalist.remove), 'function')
+ end),
+ test('`tag` is an alias for `t``', function ()
+ assert.are_equal((pandoc.MetaList{}).tag, (pandoc.MetaList{}).t)
+ 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),
+ },
+ 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 'ReaderOptions' {
+ test('returns a userdata value', function ()
+ local opts = pandoc.ReaderOptions {}
+ assert.are_equal(type(opts), 'userdata')
+ end),
+ test('can construct from table', function ()
+ local opts = pandoc.ReaderOptions {columns = 66}
+ assert.are_equal(opts.columns, 66)
+ end),
+ test('can construct from other ReaderOptions value', function ()
+ local orig = pandoc.ReaderOptions{columns = 65}
+ local copy = pandoc.ReaderOptions(orig)
+ for k, v in pairs(orig) do
+ assert.are_same(copy[k], v)
+ end
+ assert.are_equal(copy.columns, 65)
+ end),
+ },
+ },
group 'clone' {
test('clones Attr', function ()
@@ -163,6 +219,8 @@ return {
local cloned = cite:clone()
cite.id = 'newton'
assert.are_same(cloned.id, 'leibniz')
+ assert.are_same(cite.id, 'newton')
+ assert.are_same(cite.mode, cloned.mode)
end),
},
@@ -205,6 +263,22 @@ return {
})
assert.are_same(expected, pandoc.read(valid_markdown))
end),
+ test('unsupported extension', function ()
+ assert.error_matches(
+ function () pandoc.read('foo', 'gfm+empty_paragraphs') end,
+ 'Extension empty_paragraphs not supported for gfm'
+ )
+ end),
+ test('read with other indented code classes', function()
+ local indented_code = ' return true'
+ local expected = pandoc.Pandoc({
+ pandoc.CodeBlock('return true', {class='foo'})
+ })
+ assert.are_same(
+ expected,
+ pandoc.read(indented_code, 'markdown', {indented_code_classes={'foo'}})
+ )
+ end),
test('failing read', function ()
assert.error_matches(
function () pandoc.read('foo', 'nosuchreader') end,
@@ -249,5 +323,26 @@ return {
)
assert.are_equal('1234', table.concat(acc))
end)
+ },
+
+ group 'Marshal' {
+ group 'Inlines' {
+ test('Strings are broken into words', function ()
+ assert.are_equal(
+ pandoc.Emph 'Nice, init?',
+ pandoc.Emph{pandoc.Str 'Nice,', pandoc.Space(), pandoc.Str 'init?'}
+ )
+ end)
+ },
+ group 'Blocks' {
+ test('Strings are broken into words and wrapped in Plain', function ()
+ assert.are_equal(
+ pandoc.Div{
+ pandoc.Plain{pandoc.Str 'Nice,', pandoc.Space(), pandoc.Str 'init?'}
+ },
+ pandoc.Div{'Nice, init?'}
+ )
+ end)
+ }
}
}