Added the filename of an automatic test as its test-label

This commit is contained in:
Neil Brown 2008-01-22 22:42:29 +00:00
parent dc0d9b16d4
commit 9c9295fd74

View File

@ -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