aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-11-08 12:14:44 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2021-11-08 12:22:33 +0100
commitab0fe676a8507ea1ff4e77b97f548a92b13b6317 (patch)
tree7b181b9b1d433b0dc163254436c8652907b41ed0 /test
parentcc46667953b609d87bbf5611f50843871b304a0c (diff)
downloadpandoc-ab0fe676a8507ea1ff4e77b97f548a92b13b6317.tar.gz
Lua: ensure that 're' module is always available.
The module is shipped with LPeg.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Lua.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index d3694d8a9..6ee07f8fa 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -18,7 +18,7 @@ import Control.Monad (when)
import HsLua as Lua hiding (Operation (Div), error)
import System.FilePath ((</>))
import Test.Tasty (TestTree, localOption)
-import Test.Tasty.HUnit (Assertion, HasCallStack, assertEqual, testCase)
+import Test.Tasty.HUnit ((@=?), Assertion, HasCallStack, assertEqual, testCase)
import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty)
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder (bulletList, definitionList, displayMath, divWith,
@@ -211,6 +211,14 @@ tests = map (localOption (QuickCheckTests 20))
ty <- Lua.ltype Lua.top
Lua.liftIO $ assertEqual "module should be a table" Lua.TypeTable ty
+ , testCase "module 'lpeg' is loaded into a global" . runLuaTest $ do
+ s <- Lua.dostring "assert(type(lpeg)=='table');assert(lpeg==require'lpeg')"
+ Lua.liftIO $ Lua.OK @=? s
+
+ , testCase "module 're' is available" . runLuaTest $ do
+ s <- Lua.dostring "require 're'"
+ Lua.liftIO $ Lua.OK @=? s
+
, testCase "informative error messages" . runLuaTest $ do
Lua.pushboolean True
-- Lua.newtable