@@ -27,18 +27,18 @@ pandocPath = ".." </> "dist" </> "build" </> "pandoc" </> "pandoc"
28data TestResult = TestPassed
28data TestResult = TestPassed
29 | TestError ExitCode
29 | TestError ExitCode
30− | TestFailed [(DI, String)]
30+ | TestFailed FilePath [(DI, String)]
31 deriving (Eq)
31 deriving (Eq)
33instance Show TestResult where
33instance Show TestResult where
34 show TestPassed = "PASSED"
34 show TestPassed = "PASSED"
35 show (TestError ec) = "ERROR " ++ show ec
35 show (TestError ec) = "ERROR " ++ show ec
36− show (TestFailed d) = "FAILED\n" ++ showDiff d
36+ show (TestFailed f d) = f ++ "\n--- expected test result\n+++ actual test result\n" ++ showDiff d
38showDiff :: [(DI, String)] -> String
38showDiff :: [(DI, String)] -> String
39showDiff [] = ""
39showDiff [] = ""
40−showDiff ((F, ln) : ds) = "|TEST| " ++ ln ++ "\n" ++ showDiff ds
40+showDiff ((F, ln) : ds) = "- " ++ ln ++ "\n" ++ showDiff ds
41−showDiff ((S, ln) : ds) = "|NORM| " ++ ln ++ "\n" ++ showDiff ds
41+showDiff ((S, ln) : ds) = "+ " ++ ln ++ "\n" ++ showDiff ds
42showDiff ((B, _ ) : ds) = showDiff ds
42showDiff ((B, _ ) : ds) = showDiff ds
44tests :: [Test]
44tests :: [Test]
@@ -183,7 +183,7 @@ testWithNormalize normalizer testname opts inp norm = testCase testname $ do
183 normContents <- readFile' normPath >>= return . filter (/='\r') . normalizer
183 normContents <- readFile' normPath >>= return . filter (/='\r') . normalizer
184 if outputContents == normContents
184 if outputContents == normContents
185 then return TestPassed
185 then return TestPassed
186− else return $ TestFailed $ getDiff (lines outputContents) (lines normContents)
186+ else return $ TestFailed normPath $ getDiff (lines outputContents) (lines normContents)
187 else return $ TestError ec
187 else return $ TestError ec
188 removeFile outputPath
188 removeFile outputPath
189 assertBool (show result) (result == TestPassed)
189 assertBool (show result) (result == TestPassed)