diff --git a/Makefile b/Makefile index 987d46fc8..edbf940ac 100644 --- a/Makefile +++ b/Makefile @@ -45,8 +45,11 @@ unittest: ./hledger.hs test # run doc tests -doctest: - tools/doctest.hs Tests.hs +doctest: tools/doctest + tools/doctest Tests.hs + +tools/doctest: tools/doctest.hs + ghc --make tools/doctest.hs # build profiling-enabled hledgerp and archive and show a cleaned-up profile # you may need to rebuild some libs: sudo cabal install --reinstall -p ... diff --git a/tools/doctest.hs b/tools/doctest.hs index f82464d3f..116122f4d 100644 --- a/tools/doctest.hs +++ b/tools/doctest.hs @@ -39,13 +39,13 @@ main = do f <- head `fmap` getArgs s <- readFile f let tests = doctests s - putStrLn $ printf "running %d doctests from %s" (length tests) f + putStrLn $ printf "Running %d doctests from %s" (length tests) f mapM_ runShellDocTest $ doctests s runShellDocTest :: String -> IO Bool runShellDocTest s = do let (cmd, expected) = splitDocTest s - putStr $ printf "testing: %s .. " cmd + putStr $ printf "Testing: %s .. " cmd (_, out, _, h) <- runInteractiveCommand cmd exit <- waitForProcess h output <- hGetContents out @@ -56,7 +56,7 @@ runShellDocTest s = do putStrLn "ok" return True else do - putStr $ printf "FAILED\nexpected:\n%sgot:\n%s" expected output + putStr $ printf "FAILED\nExpected:\n%sGot:\n%s" expected output return False else do putStrLn $ printf "ERROR: %s" (show exit)