diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-09-29 00:11:52 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-09-30 09:57:03 +0200 |
commit | 2f47e04206a3869eadc5c93076e0b50d4362f9df (patch) | |
tree | 0ffc1a8097241395091cb702055b8ef8463d8e9b /test/Tests | |
parent | 950c68c83562d35bf1f93a213a33f227d1948451 (diff) | |
download | pandoc-2f47e04206a3869eadc5c93076e0b50d4362f9df.tar.gz |
Text.Pandoc.Lua: add mediabag submodule
Diffstat (limited to 'test/Tests')
-rw-r--r-- | test/Tests/Lua.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs index fea813890..ba6196ccb 100644 --- a/test/Tests/Lua.hs +++ b/test/Tests/Lua.hs @@ -7,10 +7,11 @@ import Test.Tasty (TestTree, localOption) import Test.Tasty.HUnit (Assertion, assertEqual, testCase) import Test.Tasty.QuickCheck (ioProperty, testProperty, QuickCheckTests(..)) import Text.Pandoc.Arbitrary () -import Text.Pandoc.Definition (Block, Inline, Meta, Pandoc) import Text.Pandoc.Builder ( (<>), bulletList, doc, doubleQuoted, emph , linebreak, rawBlock, singleQuoted, para, plain , space, str, strong) +import Text.Pandoc.Class (runIOorExplode) +import Text.Pandoc.Definition (Block, Inline, Meta, Pandoc) import Text.Pandoc.Lua import Foreign.Lua @@ -80,8 +81,11 @@ tests = map (localOption (QuickCheckTests 20)) assertFilterConversion :: String -> FilePath -> Pandoc -> Pandoc -> Assertion assertFilterConversion msg filterPath docIn docExpected = do - docRes <- runLuaFilter (Just "../data") ("lua" </> filterPath) [] docIn - assertEqual msg docExpected docRes + docEither <- runIOorExplode $ + runLuaFilter (Just "../data") ("lua" </> filterPath) [] docIn + case docEither of + Left _ -> fail "lua filter failed" + Right docRes -> assertEqual msg docExpected docRes roundtripEqual :: (Eq a, FromLuaStack a, ToLuaStack a) => a -> IO Bool roundtripEqual x = (x ==) <$> roundtripped |