Skip to content
Snippets Groups Projects
Commit b2a503cc authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a program for describing unexpected tests in testlog

This goes through the testlog and spits out any sections that contain
"unexpected".
parent 79b4f894
No related branches found
No related tags found
No related merge requests found
module Main (main) where
import Data.List
main :: IO ()
main = do xs <- readFile "testlog"
let ls = lines xs
tests = breakTests ls
unexpectedTests = filter (any ("unexpected" `isInfixOf`)) tests
putStr $ unlines $ concat unexpectedTests
breakTests :: [String] -> [[String]]
breakTests xs = splitStarting ("=====> " `isPrefixOf`)
-- Ignore lines telling us that we're running a .T file:
$ filter (not . ("====> Running " `isPrefixOf`)) xs
splitStarting :: (a -> Bool) -> [a] -> [[a]]
splitStarting f xs0 = case break f xs0 of
(_, intro : xs) -> ss intro xs
_ -> error "No data"
where ss intro xs = case break f xs of
(this, intro' : rest) ->
(intro : this) : ss intro' rest
(this, []) -> [intro : this]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment