Prefix pass test output with the pass name ++ ": " consistently.

This commit is contained in:
Adam Sampson 2008-02-28 16:51:53 +00:00
parent 06ad1e5e06
commit 62b9c9b105

View File

@ -291,12 +291,15 @@ testPassGetItems testName expected actualPass startStateTrans =
--passResult :: Either String b
do passResult <- runPass actualPass startState
case passResult of
(st,Left (_,err)) -> return (st, Left $ assertFailure (testName ++ "; pass actually failed: " ++ err))
(st,Right resultItem) -> return (st, transformEither (sequence_ . map (assertFailure . ((++) testName))) (id) $ getMatchedItems expected resultItem )
(st, Left (_, err)) -> return (st, Left $ assertFailure (prefixErr $ "pass actually failed: " ++ err))
(st, Right resultItem) -> return (st, transformEither (mapM_ (assertFailure . prefixErr)) (id) $ getMatchedItems expected resultItem)
where
startState :: CompState
startState = execState startStateTrans emptyState
prefixErr :: String -> String
prefixErr err = testName ++ ": " ++ err
-- | Runs a given AST pass and returns the subsequent state, along with either an error or the result. This function is primarily intended for internal use by this module.
runPass ::
PassM b -- ^ The actual pass.