assertParse now generates test failures

This commit is contained in:
Simon Michael 2010-03-10 19:17:32 +00:00
parent b2c8933af4
commit f937f59276

View File

@ -292,7 +292,7 @@ a `is` e = assertEqual "" e a
-- | Assert a parse result is some expected value, or print a parse error.
assertParse :: (Show a, Eq a) => (Either ParseError a) -> a -> Assertion
assertParse parse expected = either printParseError (`is` expected) parse
assertParse parse expected = either (assertFailure.show) (`is` expected) parse
printParseError :: (Show a) => a -> IO ()
printParseError e = do putStr "parse error at "; print e