diff options
Diffstat (limited to 'pandoc-lua-engine/test/lua/module/pandoc-structure.lua')
| -rw-r--r-- | pandoc-lua-engine/test/lua/module/pandoc-structure.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pandoc-lua-engine/test/lua/module/pandoc-structure.lua b/pandoc-lua-engine/test/lua/module/pandoc-structure.lua index ff2abba22..159e6e27b 100644 --- a/pandoc-lua-engine/test/lua/module/pandoc-structure.lua +++ b/pandoc-lua-engine/test/lua/module/pandoc-structure.lua @@ -136,4 +136,28 @@ return { ) end), }, + group 'unique_identifier' { + test('returns an identifier based on the input', function () + local inlines = pandoc.Inlines{pandoc.Emph{'This'}, ' is nice'} + local id = structure.unique_identifier(inlines) + assert.are_equal('this-is-nice', id) + end), + test('respects the list of used IDs', function () + local inlines = pandoc.Inlines('Hello, World!') + local used = {['hello-world'] = true} + local id = structure.unique_identifier(inlines, used) + assert.are_equal('hello-world-1', id) + end), + test('defaults to pandoc Markdown identifiers', function () + local inlines = pandoc.Inlines('Mr. Jones') + local id = structure.unique_identifier(inlines, {}) + assert.are_equal('mr.-jones', id) + end), + test('can generate gfm identifiers', function () + local inlines = pandoc.Inlines('Mr. Jones') + local exts = {'gfm_auto_identifiers'} + local id = structure.unique_identifier(inlines, {}, exts) + assert.are_equal('mr-jones', id) + end), + } } |
