aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-10-26 23:21:54 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-28 12:08:52 -0700
commit7f54f76e8b5a7b45cd61a354980ef77f65baba20 (patch)
tree6c3ba071736733f2ff9628043bc04991ad82f09f /test
parent0531a4653a79b0368d6e87d7579fe27ccf6d9623 (diff)
downloadpandoc-7f54f76e8b5a7b45cd61a354980ef77f65baba20.tar.gz
T.P.Lua: merge runLuaFilter into T.P.Filter.Lua (API change)
The function `runLuaFilter` was only used in Text.Pandoc.Filter.Lua, use apply from the that module instead.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Lua.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index 3fe9c1121..1d07829f5 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -7,7 +7,7 @@ import Control.Monad (when)
import Data.Version (Version (versionBranch))
import System.FilePath ((</>))
import Test.Tasty (TestTree, localOption)
-import Test.Tasty.HUnit (Assertion, assertEqual, assertFailure, testCase)
+import Test.Tasty.HUnit (Assertion, assertEqual, testCase)
import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty)
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,
@@ -17,7 +17,8 @@ import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,
import Text.Pandoc.Class (runIOorExplode, setUserDataDir)
import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str),
Attr, Meta, Pandoc, pandocTypesVersion)
-import Text.Pandoc.Lua (runLuaFilter, runPandocLua)
+import Text.Pandoc.Filter (Filter (LuaFilter), applyFilters)
+import Text.Pandoc.Lua (runPandocLua)
import Text.Pandoc.Options (def)
import Text.Pandoc.Shared (pandocVersion)
@@ -174,13 +175,11 @@ tests = map (localOption (QuickCheckTests 20))
]
assertFilterConversion :: String -> FilePath -> Pandoc -> Pandoc -> Assertion
-assertFilterConversion msg filterPath docIn docExpected = do
- docEither <- runIOorExplode $ do
+assertFilterConversion msg filterPath docIn expectedDoc = do
+ actualDoc <- runIOorExplode $ do
setUserDataDir (Just "../data")
- runLuaFilter def ("lua" </> filterPath) [] docIn
- case docEither of
- Left exception -> assertFailure (show exception)
- Right docRes -> assertEqual msg docExpected docRes
+ applyFilters def [LuaFilter ("lua" </> filterPath)] ["HTML"] docIn
+ assertEqual msg expectedDoc actualDoc
roundtripEqual :: (Eq a, Lua.Peekable a, Lua.Pushable a) => a -> IO Bool
roundtripEqual x = (x ==) <$> roundtripped