diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-01-11 18:02:50 -0800 |
---|---|---|
committer | Nathan Gass <gass@search.ch> | 2011-01-12 11:35:34 +0100 |
commit | 715e33705f9c857c1bfd82f1f333b381d62feed4 (patch) | |
tree | c2aa11164ed7472cc56bcc03551b71cd00529270 | |
parent | eb1d0148596b91c2887233e034411763196490a5 (diff) | |
download | pandoc-715e33705f9c857c1bfd82f1f333b381d62feed4.tar.gz |
test-pandoc: More diff-like diffs in case of test failure.
-rw-r--r-- | tests/test-pandoc.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs index c7ec67705..0c70760dc 100644 --- a/tests/test-pandoc.hs +++ b/tests/test-pandoc.hs @@ -27,18 +27,18 @@ pandocPath = ".." </> "dist" </> "build" </> "pandoc" </> "pandoc" data TestResult = TestPassed | TestError ExitCode - | TestFailed [(DI, String)] + | TestFailed FilePath [(DI, String)] deriving (Eq) instance Show TestResult where show TestPassed = "PASSED" show (TestError ec) = "ERROR " ++ show ec - show (TestFailed d) = "FAILED\n" ++ showDiff d + show (TestFailed f d) = f ++ "\n--- expected test result\n+++ actual test result\n" ++ showDiff d showDiff :: [(DI, String)] -> String showDiff [] = "" -showDiff ((F, ln) : ds) = "|TEST| " ++ ln ++ "\n" ++ showDiff ds -showDiff ((S, ln) : ds) = "|NORM| " ++ ln ++ "\n" ++ showDiff ds +showDiff ((F, ln) : ds) = "- " ++ ln ++ "\n" ++ showDiff ds +showDiff ((S, ln) : ds) = "+ " ++ ln ++ "\n" ++ showDiff ds showDiff ((B, _ ) : ds) = showDiff ds tests :: [Test] @@ -183,7 +183,7 @@ testWithNormalize normalizer testname opts inp norm = testCase testname $ do normContents <- readFile' normPath >>= return . filter (/='\r') . normalizer if outputContents == normContents then return TestPassed - else return $ TestFailed $ getDiff (lines outputContents) (lines normContents) + else return $ TestFailed normPath $ getDiff (lines outputContents) (lines normContents) else return $ TestError ec removeFile outputPath assertBool (show result) (result == TestPassed) |