Lua filter tests: produce better error on test failure

This commit is contained in:
Albert Krewinkel 2018-09-19 21:27:07 +02:00
parent 4264a1b143
commit dba5c8d4e3
No known key found for this signature in database
GPG key ID: 388DC0B21F631124

View file

@ -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, testCase)
import Test.Tasty.HUnit (Assertion, assertEqual, assertFailure, testCase)
import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty)
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,
@ -179,7 +179,7 @@ assertFilterConversion msg filterPath docIn docExpected = do
setUserDataDir (Just "../data")
runLuaFilter def ("lua" </> filterPath) [] docIn
case docEither of
Left _ -> fail "lua filter failed"
Left exception -> assertFailure (show exception)
Right docRes -> assertEqual msg docExpected docRes
roundtripEqual :: (Eq a, Lua.FromLuaStack a, Lua.ToLuaStack a) => a -> IO Bool