aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Lua.hs6
-rw-r--r--test/lua/block-count.lua11
2 files changed, 17 insertions, 0 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index 06f100048..fea813890 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -70,6 +70,12 @@ tests = map (localOption (QuickCheckTests 20))
"metatable-catch-all.lua"
(doc . para $ "four words, three spaces")
(doc . para $ str "7")
+
+ , testCase "Count blocks via Block-specific catch-all" $
+ assertFilterConversion "filtering with Block catch-all failed"
+ "block-count.lua"
+ (doc $ para "one" <> para "two")
+ (doc $ para "2")
]
assertFilterConversion :: String -> FilePath -> Pandoc -> Pandoc -> Assertion
diff --git a/test/lua/block-count.lua b/test/lua/block-count.lua
new file mode 100644
index 000000000..508b05ea8
--- /dev/null
+++ b/test/lua/block-count.lua
@@ -0,0 +1,11 @@
+local num_blocks = 0
+
+function Block(el)
+ num_blocks = num_blocks + 1
+end
+
+function Pandoc(blocks, meta)
+ return pandoc.Pandoc {
+ pandoc.Para{pandoc.Str(num_blocks)}
+ }
+end