diff options
Diffstat (limited to 'pandoc-lua-engine/test/lua/module/pandoc-json.lua')
| -rw-r--r-- | pandoc-lua-engine/test/lua/module/pandoc-json.lua | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/pandoc-lua-engine/test/lua/module/pandoc-json.lua b/pandoc-lua-engine/test/lua/module/pandoc-json.lua index 46400d572..2b0adadca 100644 --- a/pandoc-lua-engine/test/lua/module/pandoc-json.lua +++ b/pandoc-lua-engine/test/lua/module/pandoc-json.lua @@ -1,6 +1,7 @@ -- -- Tests for the system module -- +local pandoc = require 'pandoc' local json = require 'pandoc.json' local tasty = require 'tasty' @@ -33,19 +34,26 @@ return { local obj = setmetatable( {title = 23}, { - __tojson = function (obj) + __tojson = function (_) return '"Nichts ist so wie es scheint"' end } ) assert.are_same(json.encode(obj), [["Nichts ist so wie es scheint"]]) end), - test('Inline (Space)', function () + test('pandoc.List', function () + local list = pandoc.List {'foo', 'bar', 'baz'} assert.are_equal( - json.encode(pandoc.Space()), - '{"t":"Space"}' + json.encode(list), + '["foo","bar","baz"]' ) end), + test('Inline (Space)', function () + assert.are_equal( + json.encode(pandoc.Space()), + '{"t":"Space"}' + ) + end), test('Block (HorizontalRule)', function () assert.are_equal( json.encode(pandoc.HorizontalRule()), @@ -85,6 +93,9 @@ return { test('object', function () assert.are_same(json.decode '{"a":5}', {a = 5}) end), + test('list of strings', function () + assert.are_equal(json.decode '["foo", "bar"]', pandoc.List{"foo", "bar"}) + end), test('Inline (Space)', function () assert.are_equal(json.decode '{"t":"Space"}', pandoc.Space()) end), |
