Added the filename of an automatic test as its test-label
This commit is contained in:
parent
dc0d9b16d4
commit
9c9295fd74
|
@ -47,7 +47,7 @@ import PreprocessOccam
|
||||||
import Utils
|
import Utils
|
||||||
|
|
||||||
automaticTest :: FilePath -> IO Test
|
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:
|
-- Bit of a hard-hack, until usage-checking is on by default:
|
||||||
defaultState :: CompState
|
defaultState :: CompState
|
||||||
|
@ -63,11 +63,11 @@ testOccam source = do result <- evalStateT (runErrorT compilation) defaultState
|
||||||
where
|
where
|
||||||
compilation = preprocessOccamSource source >>= parseOccamProgram >>= runPasses (getPassList defaultState)
|
compilation = preprocessOccamSource source >>= parseOccamProgram >>= runPasses (getPassList defaultState)
|
||||||
-- | Given a file's contents, tests it
|
-- | Given a file's contents, tests it
|
||||||
performTest :: String -> Test
|
performTest :: String -> String -> Test
|
||||||
performTest fileName
|
performTest fileName fileContents
|
||||||
= case parseTestFile fileName of
|
= case parseTestFile fileContents of
|
||||||
Left err -> TestCase $ assertFailure $ "Error processing file \"" ++ fileName ++ "\": " ++ err
|
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
|
where
|
||||||
-- Substitutes each substitution into the prologue
|
-- Substitutes each substitution into the prologue
|
||||||
|
|
Loading…
Reference in New Issue
Block a user