aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/test
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2024-06-08 14:39:58 +0200
committerAlbert Krewinkel <[email protected]>2024-06-08 14:39:58 +0200
commitd50bd30324ef9e8053d750ff0139e7d9bff1d912 (patch)
tree00fe34a0b927a1795abb07d55aff63ebd9182121 /pandoc-lua-engine/test
parent6f9814951680d1b1753ad0957b9843f338fa6489 (diff)
Lua: add tests for PANDOC_STATE global
Diffstat (limited to 'pandoc-lua-engine/test')
-rw-r--r--pandoc-lua-engine/test/lua/module/globals.lua42
1 files changed, 41 insertions, 1 deletions
diff --git a/pandoc-lua-engine/test/lua/module/globals.lua b/pandoc-lua-engine/test/lua/module/globals.lua
index 19fee3e92..52ef226bc 100644
--- a/pandoc-lua-engine/test/lua/module/globals.lua
+++ b/pandoc-lua-engine/test/lua/module/globals.lua
@@ -107,5 +107,45 @@ return {
test('wrap_text', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.wrap_text), 'string')
end),
- }
+ },
+
+ group 'PANDOC_STATE' {
+ test('is a userdata object', function ()
+ assert.are_equal(type(PANDOC_STATE), 'userdata')
+ end),
+ test('has property "input_files"', function ()
+ assert.are_equal(type(PANDOC_STATE.input_files), 'table')
+ end),
+ test('has optional property "output_file"', function ()
+ -- property may be nil
+ if PANDOC_STATE.output_file then
+ assert.are_equal(type(PANDOC_STATE.output_file), 'string')
+ end
+ end),
+ test('has property "log"', function ()
+ assert.are_equal(type(PANDOC_STATE.log), 'table')
+ end),
+ test('has property "request_headers"', function ()
+ assert.are_equal(type(PANDOC_STATE.request_headers), 'table')
+ end),
+ test('has property "resource_path"', function ()
+ assert.are_equal(type(PANDOC_STATE.resource_path), 'table')
+ end),
+ test('has optional property "source_url"', function ()
+ if PANDOC_STATE.source_url then
+ assert.are_equal(type(PANDOC_STATE.source_url), 'string')
+ end
+ end),
+ test('has property "trace"', function ()
+ assert.are_equal(type(PANDOC_STATE.trace), 'boolean')
+ end),
+ test('has optional property "user_data_dir"', function ()
+ if PANDOC_STATE.user_data_dir then
+ assert.are_equal(type(PANDOC_STATE.user_data_dir), 'string')
+ end
+ end),
+ test('has property "verbosity"', function ()
+ assert.are_equal(type(PANDOC_STATE.verbosity), 'string')
+ end),
+ },
}