git @ Cat's Eye Technologies Falderal / 668bb38
Establish the test-running API as it will be for version 0.1. catseye 9 years ago
2 changed file(s) with 24 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2323 The Falderal Driver
2424 -------------------
2525
26 > testDemo = Runner.run "Test/Falderal/Demo.lhs" [
26 Naming the test function "test" makes testing the file as simple as:
27
28 ghc Test/Falderal/Demo.lhs -e test
29
30 > test = Runner.run ["Test/Falderal/Demo.lhs"] [] [
2731 > ("Tests for everySecond", everySecond),
2832 > ("Tests for parseBits", show . parseBits)
2933 > ]
0 module Test.Falderal.Runner where
0 module Test.Falderal.Runner (run) where
11
22 --
33 -- The Falderal Test Runner
4141 deriving (Show, Eq, Ord)
4242
4343 --
44 -- Main entry point to test runner.
45 --
46 -- First argument is a list of filenames to harvest and run tests from.
47 -- Second argument is a "property list" of options in String format,
48 -- currently not used.
49 -- Third argument maps section headers to the function to be tested in
50 -- that section.
51 --
52
53 run :: [String] -> [(String, String)] -> [(String, String -> String)] -> IO ()
54
55 run [] options funMap =
56 return ()
57 run (filename:filenames) options funMap = do
58 loadAndRunTests filename funMap
59 run filenames options funMap
60
61 --
4462 -- File loading functions.
4563 --
46
47 run fileName funMap =
48 loadAndRunTests fileName funMap
4964
5065 loadAndRunTests fileName funMap = do
5166 tests <- loadFile fileName