@@ -17,6 +17,7 @@ import Text.Pandoc.Highlighting ( languages )
17import Prelude hiding ( readFile )
17import Prelude hiding ( readFile )
18import qualified Data.ByteString.Lazy as B
18import qualified Data.ByteString.Lazy as B
19import Data.ByteString.Lazy.UTF8 (toString)
19import Data.ByteString.Lazy.UTF8 (toString)
21readFileUTF8 :: FilePath -> IO String
22readFileUTF8 :: FilePath -> IO String
22readFileUTF8 f = B.readFile f >>= return . toString
23readFileUTF8 f = B.readFile f >>= return . toString
@@ -33,13 +34,13 @@ instance Show TestResult where
33 show TestPassed = "PASSED"
34 show TestPassed = "PASSED"
34 show (TestError ec) = "ERROR " ++ show ec
35 show (TestError ec) = "ERROR " ++ show ec
35 show (TestFailed cmd file d) = "\n--- " ++ file ++
36 show (TestFailed cmd file d) = "\n--- " ++ file ++
36− "\n+++ " ++ cmd ++ "\n" ++ showDiff d
37+ "\n+++ " ++ cmd ++ "\n" ++ showDiff (1,1) d
38−showDiff :: [(DI, String)] -> String
39+showDiff :: (Int,Int) -> [(DI, String)] -> String
39−showDiff [] = ""
40+showDiff _ [] = ""
40−showDiff ((F, ln) : ds) = "+ " ++ ln ++ "\n" ++ showDiff ds
41+showDiff (l,r) ((F, ln) : ds) = printf "%4d +" l ++ ln ++ "\n" ++ showDiff (l+1,r) ds
41−showDiff ((S, ln) : ds) = "- " ++ ln ++ "\n" ++ showDiff ds
42+showDiff (l,r) ((S, ln) : ds) = printf "%4d -" r ++ ln ++ "\n" ++ showDiff (l,r+1) ds
42−showDiff ((B, _ ) : ds) = showDiff ds
43+showDiff (l,r) ((B, _ ) : ds) = showDiff (l+1,r+1) ds
44tests :: [Test]
45tests :: [Test]
45tests = [ testGroup "markdown" [ testGroup "writer" (writerTests "markdown" ++ lhsWriterTests "markdown")
46tests = [ testGroup "markdown" [ testGroup "writer" (writerTests "markdown" ++ lhsWriterTests "markdown")