Cabal-1.16.0: A framework for packaging Haskell software

Portability | portable
Maintainer | cabal-devel@haskell.org
Safe Haskell | None

Distribution.Simple.Test

Description

This is the entry point into testing a built package. It performs the "`./setup test`" action. It runs test suites designated in the package description and reports on the results.

Synopsis

- test :: PackageDescription -> LocalBuildInfo -> TestFlags -> IO ()
- stubMain :: IO [Test] -> IO ()
- writeSimpleTestStub :: TestSuite -> FilePath -> IO ()
- stubFilePath :: TestSuite -> FilePath
- stubName :: TestSuite -> FilePath
- data PackageLog = PackageLog {
  - package :: PackageId
  - compiler :: CompilerId
  - platform :: Platform
  - testSuites :: [TestSuiteLog]
  }
- data TestSuiteLog = TestSuiteLog {
  - testSuiteName :: String
  - testLogs :: TestLogs
  - logFile :: FilePath
  }
- data TestLogs
  - = TestLog {
    - testName :: String
    - testOptionsReturned :: Options
    - testResult :: Result
    }
  - | GroupLogs String [TestLogs]
- suitePassed :: TestSuiteLog -> Bool
- suiteFailed :: TestSuiteLog -> Bool
- suiteError :: TestSuiteLog -> Bool

# Documentation

test

Arguments

:: PackageDescription | information from the .cabal file
-> LocalBuildInfo | information from the configure step
-> TestFlags | flags sent to test
-> IO () |

Perform the "`./setup test`" action.

stubMain :: IO [Test] -> IO ()

Main function for test stubs. Once, it was written directly into the stub, but minimizing the amount of code actually in the stub maximizes the number of detectable errors when Cabal is compiled.

writeSimpleTestStub

Arguments

:: TestSuite | library `TestSuite` for which a stub is being created
-> FilePath | path to directory where stub source should be located
-> IO () |

Write the source file for a library `TestSuite` stub executable.

stubFilePath :: TestSuite -> FilePath

The filename of the source file for the stub executable associated with a library `TestSuite`.

stubName :: TestSuite -> FilePath

The name of the stub executable associated with a library `TestSuite`.

data PackageLog

Logs all test results for a package, broken down first by test suite and then by test case.

Constructors

PackageLog |
Fields package :: PackageId compiler :: CompilerId platform :: Platform testSuites :: [TestSuiteLog]

Instances

Eq PackageLog |
Read PackageLog |
Show PackageLog |

data TestSuiteLog

Logs test suite results, itemized by test case.

Constructors

TestSuiteLog |
Fields testSuiteName :: String testLogs :: TestLogs logFile :: FilePath

Instances

Eq TestSuiteLog |
Read TestSuiteLog |
Show TestSuiteLog |

data TestLogs

Constructors

TestLog |
Fields testName :: String testOptionsReturned :: Options testResult :: Result
GroupLogs String [TestLogs] |

Instances

Eq TestLogs |
Read TestLogs |
Show TestLogs |

suitePassed :: TestSuiteLog -> Bool

From a `TestSuiteLog`, determine if the test suite passed.

suiteFailed :: TestSuiteLog -> Bool

From a `TestSuiteLog`, determine if the test suite failed.

suiteError :: TestSuiteLog -> Bool

From a `TestSuiteLog`, determine if the test suite encountered errors.