aboutsummaryrefslogtreecommitdiff
path: root/test/Tests
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-01-13 18:52:17 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2018-01-13 18:52:17 +0100
commit9fdd266677410e7a90e72bb87013cd5043433d59 (patch)
tree643c72a223ab3ad877dba7913b4c888d45b148eb /test/Tests
parent1d639456d3371a52a17dfa41bb81327d089b41f9 (diff)
downloadpandoc-9fdd266677410e7a90e72bb87013cd5043433d59.tar.gz
data/pandoc.lua: accept singleton inline as a list
Every constructor which accepts a list of inlines now also accepts a single inline element for convenience.
Diffstat (limited to 'test/Tests')
-rw-r--r--test/Tests/Lua.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index 9df5e79cd..c7652a200 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -12,7 +12,8 @@ import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,
header, linebreak, para, plain, rawBlock,
singleQuoted, space, str, strong, (<>))
import Text.Pandoc.Class (runIOorExplode, setUserDataDir)
-import Text.Pandoc.Definition (Block, Inline, Meta, Pandoc, pandocTypesVersion)
+import Text.Pandoc.Definition (Block, Inline (Emph, Str), Meta, Pandoc,
+ pandocTypesVersion)
import Text.Pandoc.Lua (runLuaFilter, runPandocLua)
import Text.Pandoc.Options (def)
import Text.Pandoc.Shared (pandocVersion)
@@ -124,6 +125,10 @@ tests = map (localOption (QuickCheckTests 20))
Lua.liftIO . assertEqual "pandoc-types version is wrong" versionNums
=<< Lua.peek Lua.stackTop
+ , testCase "Allow singleton inline in constructors" . runPandocLua' $ do
+ res <- Lua.callFunc "pandoc.Emph" (Str "test")
+ Lua.liftIO $ assertEqual "Not the exptected Emph" (Emph [Str "test"]) res
+
, testCase "informative error messages" . runPandocLua' $ do
Lua.pushboolean True
err <- Lua.peekEither Lua.stackTop :: Lua.Lua (Either String Pandoc)