summaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/test
diff options
context:
space:
mode:
Diffstat (limited to 'pandoc-lua-engine/test')
-rw-r--r--pandoc-lua-engine/test/Tests/Lua/Writer.hs10
-rw-r--r--pandoc-lua-engine/test/writer-template.lua2
-rw-r--r--pandoc-lua-engine/test/writer-template.out.txt3
3 files changed, 5 insertions, 10 deletions
diff --git a/pandoc-lua-engine/test/Tests/Lua/Writer.hs b/pandoc-lua-engine/test/Tests/Lua/Writer.hs
index c9a0d478c..97d772bc5 100644
--- a/pandoc-lua-engine/test/Tests/Lua/Writer.hs
+++ b/pandoc-lua-engine/test/Tests/Lua/Writer.hs
@@ -11,6 +11,7 @@ Tests for custom Lua writers.
module Tests.Lua.Writer (tests) where
import Data.Default (Default (def))
+import Data.Maybe (fromMaybe)
import Text.Pandoc.Class (runIOorExplode, readFileStrict)
import Text.Pandoc.Extensions (Extension (..))
import Text.Pandoc.Format (ExtensionsDiff (..), FlavoredFormat (..),
@@ -59,13 +60,8 @@ tests =
, goldenVsString "template"
"writer-template.out.txt"
(runIOorExplode $ do
- txt <- writeCustom "writer-template.lua" >>= \case
- (TextWriter f, _, mt) -> do
- template <- mt
- let opts = def{ writerTemplate = Just template }
- f opts (B.doc (B.plain (B.str "body goes here")))
- _ -> error "Expected a text writer"
- pure $ BL.fromStrict (UTF8.fromText txt))
+ (_, _, template) <- writeCustom "writer-template.lua"
+ pure . BL.fromStrict . UTF8.fromText $ fromMaybe "" template)
, testCase "preset extensions" $ do
let ediff = ExtensionsDiff{extsToEnable = [], extsToDisable = []}
diff --git a/pandoc-lua-engine/test/writer-template.lua b/pandoc-lua-engine/test/writer-template.lua
index c90f7c1ef..8908c0ebb 100644
--- a/pandoc-lua-engine/test/writer-template.lua
+++ b/pandoc-lua-engine/test/writer-template.lua
@@ -3,5 +3,5 @@ function Writer (doc, opts)
end
function Template ()
- return pandoc.template.compile '<!-- start -->\n$body$\n<!-- stop -->\n'
+ return '<!-- start -->\n$body$\n<!-- stop -->\n'
end
diff --git a/pandoc-lua-engine/test/writer-template.out.txt b/pandoc-lua-engine/test/writer-template.out.txt
index 1fb343c28..18e531cff 100644
--- a/pandoc-lua-engine/test/writer-template.out.txt
+++ b/pandoc-lua-engine/test/writer-template.out.txt
@@ -1,4 +1,3 @@
<!-- start -->
-body goes here
-
+$body$
<!-- stop -->