Skip to content

Commit d50bd30

Browse files
committed
Lua: add tests for PANDOC_STATE global
1 parent 6f98149 commit d50bd30

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

pandoc-lua-engine/test/lua/module/globals.lua

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,45 @@ return {
107107
test('wrap_text', function ()
108108
assert.are_equal(type(PANDOC_WRITER_OPTIONS.wrap_text), 'string')
109109
end),
110-
}
110+
},
111+
112+
group 'PANDOC_STATE' {
113+
test('is a userdata object', function ()
114+
assert.are_equal(type(PANDOC_STATE), 'userdata')
115+
end),
116+
test('has property "input_files"', function ()
117+
assert.are_equal(type(PANDOC_STATE.input_files), 'table')
118+
end),
119+
test('has optional property "output_file"', function ()
120+
-- property may be nil
121+
if PANDOC_STATE.output_file then
122+
assert.are_equal(type(PANDOC_STATE.output_file), 'string')
123+
end
124+
end),
125+
test('has property "log"', function ()
126+
assert.are_equal(type(PANDOC_STATE.log), 'table')
127+
end),
128+
test('has property "request_headers"', function ()
129+
assert.are_equal(type(PANDOC_STATE.request_headers), 'table')
130+
end),
131+
test('has property "resource_path"', function ()
132+
assert.are_equal(type(PANDOC_STATE.resource_path), 'table')
133+
end),
134+
test('has optional property "source_url"', function ()
135+
if PANDOC_STATE.source_url then
136+
assert.are_equal(type(PANDOC_STATE.source_url), 'string')
137+
end
138+
end),
139+
test('has property "trace"', function ()
140+
assert.are_equal(type(PANDOC_STATE.trace), 'boolean')
141+
end),
142+
test('has optional property "user_data_dir"', function ()
143+
if PANDOC_STATE.user_data_dir then
144+
assert.are_equal(type(PANDOC_STATE.user_data_dir), 'string')
145+
end
146+
end),
147+
test('has property "verbosity"', function ()
148+
assert.are_equal(type(PANDOC_STATE.verbosity), 'string')
149+
end),
150+
},
111151
}

0 commit comments

Comments
 (0)