1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
local tasty = require 'tasty'
local test = tasty.test_case
local group = tasty.test_group
local assert = tasty.assert
-- These tests exist mainly to catch changes to the JSON representation of
-- WriterOptions and its components. UPDATE THE DOCS if anything changes.
return {
group 'PANDOC_WRITER_OPTIONS' {
test('chunk_template', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.chunk_template), 'string')
end),
test('cite_method', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.cite_method), 'string')
end),
test('columns', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.columns), 'number')
end),
test('dpi', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.dpi), 'number')
end),
test('email_obfuscation', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.email_obfuscation), 'string')
end),
test('split_level', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.split_level), 'number')
end),
test('epub_fonts', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.epub_fonts), 'table')
end),
test('epub_metadata', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.epub_metadata), 'nil')
end),
test('epub_subdirectory', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.epub_subdirectory), 'string')
end),
test('extensions', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.extensions), 'table')
for _, v in ipairs(PANDOC_WRITER_OPTIONS.extensions) do
assert.are_equal(type(v), 'string')
end
end),
test('highlight_method', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.highlight_method), 'string')
end),
test('html_math_method', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.html_math_method), 'string')
end),
test('html_q_tags', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.html_q_tags), 'boolean')
end),
test('identifier_prefix', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.identifier_prefix), 'string')
end),
test('incremental', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.incremental), 'boolean')
end),
test('number_offset', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.number_offset), 'table')
for _, v in ipairs(PANDOC_WRITER_OPTIONS.number_offset) do
assert.are_equal(type(v), 'number')
end
end),
test('number_sections', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.number_sections), 'boolean')
end),
test('prefer_ascii', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.prefer_ascii), 'boolean')
end),
test('reference_doc', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.reference_doc), 'nil')
end),
test('reference_links', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.reference_links), 'boolean')
end),
test('reference_location', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.reference_location), 'string')
end),
test('section_divs', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.section_divs), 'boolean')
end),
test('setext_headers', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.setext_headers), 'boolean')
end),
test('slide_level', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.slide_level), 'nil')
end),
test('tab_stop', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.tab_stop), 'number')
end),
test('table_of_contents', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.table_of_contents), 'boolean')
end),
test('toc_depth', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.toc_depth), 'number')
end),
test('top_level_division', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.top_level_division), 'string')
end),
test('variables', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.variables), 'table')
end),
test('wrap_text', function ()
assert.are_equal(type(PANDOC_WRITER_OPTIONS.wrap_text), 'string')
end),
},
group 'PANDOC_STATE' {
test('is a table object', function ()
assert.are_equal(type(PANDOC_STATE), 'table')
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),
test('can be deleted without breaking PandocLua monad functions', function()
local state = PANDOC_STATE
PANDOC_STATE = nil
assert.is_nil(pandoc.mediabag.lookup('does-not-exist'))
PANDOC_STATE = state
end),
},
}
|