From 9c9295fd7438e92dfaf4f2c24a811b25258f95ec Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 22 Jan 2008 22:42:29 +0000 Subject: [PATCH] Added the filename of an automatic test as its test-label --- common/TestHarness.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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