@@ -67,18 +67,18 @@ dropPercent :: String -> String
67dropPercent ('%':xs) = dropWhile (== ' ') xs
67dropPercent ('%':xs) = dropWhile (== ' ') xs
68dropPercent xs = xs
68dropPercent xs = xs
70−runCommandTest :: FilePath -> (Int, String) -> IO TestTree
70+runCommandTest :: FilePath -> (Int, String) -> TestTree
71−runCommandTest pandocpath (num, code) = do
71+runCommandTest pandocpath (num, code) =
72 let codelines = lines code
72 let codelines = lines code
73− let (continuations, r1) = span ("\\" `isSuffixOf`) codelines
73+ (continuations, r1) = span ("\\" `isSuffixOf`) codelines
74− let (cmd, r2) = (dropPercent (unwords (map init continuations ++ take 1 r1)),
74+ (cmd, r2) = (dropPercent (unwords (map init continuations ++ take 1 r1)),
75 drop 1 r1)
75 drop 1 r1)
76− let (inplines, r3) = break (=="^D") r2
76+ (inplines, r3) = break (=="^D") r2
77− let normlines = takeWhile (/=".") (drop 1 r3)
77+ normlines = takeWhile (/=".") (drop 1 r3)
78− let input = unlines inplines
78+ input = unlines inplines
79− let norm = unlines normlines
79+ norm = unlines normlines
80− let shcmd = trimr $ takeDirectory pandocpath </> cmd
80+ shcmd = trimr $ takeDirectory pandocpath </> cmd
81− return $ runTest ("#" ++ show num) shcmd input norm
81+ in runTest ("#" ++ show num) shcmd input norm
83extractCommandTest :: FilePath -> TestTree
83extractCommandTest :: FilePath -> TestTree
84extractCommandTest fp = unsafePerformIO $ do
84extractCommandTest fp = unsafePerformIO $ do
@@ -87,6 +87,6 @@ extractCommandTest fp = unsafePerformIO $ do
87 Pandoc _ blocks <- runIOorExplode (readMarkdown
87 Pandoc _ blocks <- runIOorExplode (readMarkdown
88 def{ readerExtensions = pandocExtensions } contents)
88 def{ readerExtensions = pandocExtensions } contents)
89 let codeblocks = map extractCode $ filter isCodeBlock $ blocks
89 let codeblocks = map extractCode $ filter isCodeBlock $ blocks
90− cases <- mapM (runCommandTest pandocpath) $ zip [1..] codeblocks
90+ let cases = map (runCommandTest pandocpath) $ zip [1..] codeblocks
91 return $ testGroup fp cases
91 return $ testGroup fp cases