From 75aee7a23c96ff31aa9fcb7608891c33a011d6a1 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 31 Jul 2025 11:49:20 +0200 Subject: Lua: use proper interface functions to access the CommonState. - The `PANDOC_STATE` is no longer a userdata object, but a table that behaves like the old object. - Log messages in `PANDOC_STATE.log` are now in temporal order. --- pandoc-lua-engine/test/lua/module/pandoc-log.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pandoc-lua-engine/test/lua/module/pandoc-log.lua') diff --git a/pandoc-lua-engine/test/lua/module/pandoc-log.lua b/pandoc-lua-engine/test/lua/module/pandoc-log.lua index 923f03cd9..1daf6240d 100644 --- a/pandoc-lua-engine/test/lua/module/pandoc-log.lua +++ b/pandoc-lua-engine/test/lua/module/pandoc-log.lua @@ -22,13 +22,13 @@ return { end), test('reports a warning', function () log.info('info test') - local msg = json.decode(json.encode(PANDOC_STATE.log[1])) + local msg = json.decode(json.encode(PANDOC_STATE.log:at(-1))) assert.are_equal(msg.message, 'info test') assert.are_equal(msg.type, 'ScriptingInfo') end), test('info includes the correct number', function () log.info('line number test') - local msg = json.decode(json.encode(PANDOC_STATE.log[1])) + local msg = json.decode(json.encode(PANDOC_STATE.log:at(-1))) -- THIS NEEDS UPDATING if lines above are shifted. assert.are_equal(msg.line, 30) end), @@ -40,7 +40,7 @@ return { end), test('reports a warning', function () log.warn('testing') - local msg = json.decode(json.encode(PANDOC_STATE.log[1])) + local msg = json.decode(json.encode(PANDOC_STATE.log:at(-1))) assert.are_equal(msg.message, 'testing') assert.are_equal(msg.type, 'ScriptingWarning') end), -- cgit v1.2.3