@@ -23,7 +23,6 @@ import Text.Pandoc.Writers.Native (writeNative)
2323import Language.Haskell.TH.Quote (QuasiQuoter(..))
2424import Language.Haskell.TH.Syntax (Q, runIO)
2525import qualified Test.QuickCheck.Property as QP
26−import System.Console.ANSI
2726import Data.Algorithm.Diff
2827
2928lit :: QuasiQuoter
@@ -54,25 +53,21 @@ test :: (ToString a, ToString b, ToString c)
5453test fn name (input, expected) =
5554 testCase name $ assertBool msg (actual' == expected')
5655 where msg = nl ++ dashes "input" ++ nl ++ input' ++ nl ++
57− dashes "expected" ++ nl ++ expected'' ++
58− dashes "got" ++ nl ++ actual'' ++
56+ dashes "result" ++ nl ++
57+ unlines (map vividize diff) ++
5958 dashes ""
6059 nl = "\n"
6160 input' = toString input
62− actual' = toString $ fn input
63− expected' = toString expected
64− diff = getDiff (lines expected') (lines actual')
65− expected'' = unlines $ map vividize [First x | First x <- diff]
66− actual'' = unlines $ map vividize [Second x | Second x <- diff]
61+ actual' = lines $ toString $ fn input
62+ expected' = lines $ toString expected
63+ diff = getDiff expected' actual'
6764 dashes "" = replicate 72 '-'
6865 dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---"
6966
7067vividize :: Diff String -> String
71−vividize (Both s _) = s
72−vividize (First s) = s
73−vividize (Second s) = setSGRCode [SetColor Background Dull Red
74− , SetColor Foreground Vivid White] ++ s
75− ++ setSGRCode [Reset]
68+vividize (Both s _) = " " ++ s
69+vividize (First s) = "- " ++ s
70+vividize (Second s) = "+ " ++ s
7671
7772property :: QP.Testable a => TestName -> a -> Test
7873property = testProperty