aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Lua.hs3
-rw-r--r--test/lua/test-pandoc-utils.lua16
2 files changed, 18 insertions, 1 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index 7fb4309de..6f495a3ca 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -96,7 +96,8 @@ tests = map (localOption (QuickCheckTests 20))
assertFilterConversion "pandoc.utils doesn't work as expected."
"test-pandoc-utils.lua"
(doc $ para "doesn't matter")
- (doc $ mconcat [ plain (str "normalize_date: OK")
+ (doc $ mconcat [ plain (str "hierarchicalize: OK")
+ , plain (str "normalize_date: OK")
, plain (str "pipe: OK")
, plain (str "failing pipe: OK")
, plain (str "read: OK")
diff --git a/test/lua/test-pandoc-utils.lua b/test/lua/test-pandoc-utils.lua
index b79f033f8..c732d2f85 100644
--- a/test/lua/test-pandoc-utils.lua
+++ b/test/lua/test-pandoc-utils.lua
@@ -1,5 +1,20 @@
utils = require 'pandoc.utils'
+-- hierarchicalize
+------------------------------------------------------------------------
+function test_hierarchicalize ()
+ local blks = {
+ pandoc.Header(1, {pandoc.Str 'First'}),
+ pandoc.Header(2, {pandoc.Str 'Second'}),
+ pandoc.Header(2, {pandoc.Str 'Third'}),
+ }
+ local hblks = utils.hierarchicalize(blks)
+ return hblks[1].t == "Sec"
+ and hblks[1].contents[1].t == "Sec"
+ and hblks[1].contents[2].numbering[1] == 1
+ and hblks[1].contents[2].numbering[2] == 2
+end
+
-- SHA1
------------------------------------------------------------------------
function test_sha1 ()
@@ -87,6 +102,7 @@ end
function Para (el)
return {
+ pandoc.Plain{pandoc.Str("hierarchicalize: " .. run(test_hierarchicalize))},
pandoc.Plain{pandoc.Str("normalize_date: " .. run(test_normalize_date))},
pandoc.Plain{pandoc.Str("pipe: " .. run(test_pipe))},
pandoc.Plain{pandoc.Str("failing pipe: " .. run(test_failing_pipe))},