aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Lua.hs8
-rw-r--r--test/lua/markdown-reader.lua3
-rw-r--r--test/lua/plain-to-para.lua4
-rw-r--r--test/lua/strmacro.lua9
4 files changed, 14 insertions, 10 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index 64c35b298..4196ff4b7 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -64,10 +64,14 @@ roundtripEqual x = (x ==) <$> roundtripped
roundtripped :: (Lua.StackValue a) => IO a
roundtripped = do
lua <- Lua.newstate
+ Lua.openlibs lua
+ pushPandocModule lua
+ Lua.setglobal lua "pandoc"
+ oldSize <- Lua.gettop lua
Lua.push lua x
size <- Lua.gettop lua
- when (size /= 1) $
- error ("not exactly one element on the stack: " ++ show size)
+ when ((size - oldSize) /= 1) $
+ error ("not exactly one additional element on the stack: " ++ show size)
res <- Lua.peek lua (-1)
retval <- case res of
Nothing -> error "could not read from stack"
diff --git a/test/lua/markdown-reader.lua b/test/lua/markdown-reader.lua
index 6356113ec..a72af5546 100644
--- a/test/lua/markdown-reader.lua
+++ b/test/lua/markdown-reader.lua
@@ -1,7 +1,6 @@
return {
{
- RawBlock = function (blk)
- local format, content = unpack(blk.c)
+ RawBlock = function (format, content)
if format == "markdown" then
return pandoc.reader.markdown.read_block(content)
else
diff --git a/test/lua/plain-to-para.lua b/test/lua/plain-to-para.lua
index 747257411..a11edbbe2 100644
--- a/test/lua/plain-to-para.lua
+++ b/test/lua/plain-to-para.lua
@@ -1,6 +1,6 @@
return {
- { Plain = function (blk)
- return pandoc.Para(blk.c)
+ { Plain = function (content)
+ return pandoc.Para(content)
end,
}
}
diff --git a/test/lua/strmacro.lua b/test/lua/strmacro.lua
index 1b28801be..40756a476 100644
--- a/test/lua/strmacro.lua
+++ b/test/lua/strmacro.lua
@@ -1,10 +1,11 @@
return {
- { Str = function (inline)
- if inline.c == "{{helloworld}}" then
+ {
+ Str = function (str)
+ if str == "{{helloworld}}" then
return pandoc.Emph {pandoc.Str "Hello, World"}
else
- return inline
+ return pandoc.Str(str)
end
- end,
+ end,
}
}