Safe Haskell | Safe-Infered |
---|
Test.TBC
- booltest :: TestConvention
- exception :: TestConvention
- hunit :: TestConvention
- quickcheck :: TestConvention
- stdDirectoryConv :: DirectoryConvention s
- stdTestFileConv :: TestFileConvention s
- std :: Conventions s
- type DirectoryConvention s = FilePath -> s -> (Action, s)
- type TestFileConvention s = FilePath -> s -> (Action, s)
- type TestConvention = String -> Maybe (Driver -> IO Result)
- data Action
- data Test = Test {}
- data Result
- type Renderer s = Verbosity -> RenderFns s
- data RenderFns s = RenderFns {}
- data Conventions s = Conventions {}
- data Verbosity
- silent :: Verbosity
- normal :: Verbosity
- verbose :: Verbosity
- deafening :: Verbosity
- warn :: Verbosity -> String -> IO ()
- notice :: Verbosity -> String -> IO ()
- setupMessage :: Verbosity -> String -> PackageIdentifier -> IO ()
- info :: Verbosity -> String -> IO ()
- debug :: Verbosity -> String -> IO ()
- data Location = Location {}
- mkLocation :: FilePath -> Int -> Int -> Location
- mkTestName :: String -> String
- traverseDirectories :: Conventions s -> Driver -> RenderFns s -> [FilePath] -> s -> IO s
- applyTestConventions :: [TestConvention] -> FilePath -> String -> [Test]
- data Driver = MkDriver {}
- ghci :: Verbosity -> String -> [String] -> IO Driver
- tbc :: Driver -> [FilePath] -> IO ()
- tbcWithHooks :: Conventions s -> RenderFns s -> Driver -> [FilePath] -> IO ExitCode
- tbcCabal :: Verbosity -> Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
- defaultMain :: IO ()
Conventions and data structures.
exception :: TestConventionSource
The seq
ed test should throw an exception.
A HUnit unit test.
quickcheck :: TestConventionSource
A QuickCheck test. We use the quickCheck
driver, i.e., the default settings.
stdDirectoryConv :: DirectoryConvention sSource
Skip .darcs
and .git
directories, and Cabal's dist
directory.
Could also imagine skipping subproject directories.
stdTestFileConv :: TestFileConvention sSource
Skip Cabal's Setup.hs
.
std :: Conventions sSource
The standard set of conventions.
type DirectoryConvention s = FilePath -> s -> (Action, s)Source
A directory convention maps a directory name into an action.
type TestFileConvention s = FilePath -> s -> (Action, s)Source
A test file convention maps a file name into an action.
type TestConvention = String -> Maybe (Driver -> IO Result)Source
A test convention maps a line in a TestFile
into a function
that runs the test.
An action tells TBC what to do when it (recursively) encounters a directory or file.
A single test.
The result of a single Test
.
Constructors
TestResultSkip | Skip this test. |
TestResultToDo | This test has not yet been written. |
TestResultStop | Cease testing. |
TestResultSuccess | The test succeeded. |
TestResultFailure | The test failed with this explanation. |
type Renderer s = Verbosity -> RenderFns sSource
A renderer maps a verbosity level into a bunch of functions that tells the user of various events.
The collection of rendering functions.
Constructors
RenderFns | |
Fields
|
data Conventions s Source
A collection of conventions.
Constructors
Conventions | |
Fields
|
data Verbosity
warn :: Verbosity -> String -> IO ()
Non fatal conditions that may be indicative of an error or problem.
We display these at the normal
verbosity level.
notice :: Verbosity -> String -> IO ()
Useful status messages.
We display these at the normal
verbosity level.
This is for the ordinary helpful status messages that users see. Just enough information to know that things are working but not floods of detail.
setupMessage :: Verbosity -> String -> PackageIdentifier -> IO ()
info :: Verbosity -> String -> IO ()
More detail on the operation of some action.
We display these messages when the verbosity level is verbose
debug :: Verbosity -> String -> IO ()
Detailed internal debugging information
We display these messages when the verbosity level is deafening
Location of a Test
.
mkTestName :: String -> StringSource
Discern a test name from a string, viz the entirety of the varid starting at the start of the string. FIXME this should follow the Haskell lexical conventions and perhaps be more robust.
traverseDirectories :: Conventions s -> Driver -> RenderFns s -> [FilePath] -> s -> IO sSource
Visit all files in a directory tree. FIXME try to eliminate the . with some refactoring.
applyTestConventions :: [TestConvention] -> FilePath -> String -> [Test]Source
Apply a list of conventions to the guts of a TestFile
.
Interaction with a Haskell system.
A driver for GHCi
using a slave process.
Top-level drivers.
tbcWithHooks :: Conventions s -> RenderFns s -> Driver -> [FilePath] -> IO ExitCodeSource
A parametrised bells-and-whistles driver.
Arguments
:: Verbosity | |
-> Args | Where are the tests (dirs and files)? |
-> Bool | |
-> PackageDescription | |
-> LocalBuildInfo | |
-> IO () |
A driver compatible with Cabal's runTests
hook.
However the test infrastructure in Cabal has changed since this was written, and its use is discouraged. Use the TBC binary instead.
This is used by the TBC binary.
This is a drop-in replacement for Cabal's
defaultMain
.
However the test infrastructure in Cabal has changed since this was written, and its use is discouraged. Use the TBC binary instead.