diff --git a/common/TestHarness.hs b/common/TestHarness.hs index da99080..4a659cc 100644 --- a/common/TestHarness.hs +++ b/common/TestHarness.hs @@ -47,7 +47,7 @@ import PreprocessOccam import Utils automaticTest :: FilePath -> IO Test -automaticTest fileName = readFile fileName >>* performTest +automaticTest fileName = readFile fileName >>* performTest fileName -- Bit of a hard-hack, until usage-checking is on by default: defaultState :: CompState @@ -63,11 +63,11 @@ testOccam source = do result <- evalStateT (runErrorT compilation) defaultState where compilation = preprocessOccamSource source >>= parseOccamProgram >>= runPasses (getPassList defaultState) -- | Given a file's contents, tests it -performTest :: String -> Test -performTest fileName - = case parseTestFile fileName of +performTest :: String -> String -> Test +performTest fileName fileContents + = case parseTestFile fileContents of Left err -> TestCase $ assertFailure $ "Error processing file \"" ++ fileName ++ "\": " ++ err - Right (prologue,tests) -> TestList $ map performTest' (substitute prologue tests) + Right (prologue,tests) -> TestLabel fileName $ TestList $ map performTest' (substitute prologue tests) where -- Substitutes each substitution into the prologue