diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-09-30 10:50:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-30 10:50:02 -0400 |
commit | 9b7d652ab7a0f4cdd86efd92f43f1b20724e8982 (patch) | |
tree | 86ca5048451a0a73409d83ba9a092c870f0e7928 /test/Tests/Lua.hs | |
parent | c363519302e11daab2187445f39a15ce6ef19137 (diff) | |
parent | 53b6ffe9b882fc122e99cda045619411708bf434 (diff) | |
download | pandoc-9b7d652ab7a0f4cdd86efd92f43f1b20724e8982.tar.gz |
Merge pull request #3945 from tarleb/lua-mediabag
Lua mediabag module
Diffstat (limited to 'test/Tests/Lua.hs')
-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 |