cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.CmdTest

Contents

- The `test` CLI and action
- Internals exposed for testing

Description

cabal-install CLI command: test

Synopsis

- testCommand :: CommandUI (NixStyleFlags ())
- testAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
- isSubComponentProblem :: PackageId -> ComponentName -> SubComponentTarget -> TargetProblem TestProblem
- notTestProblem :: PackageId -> ComponentName -> TargetProblem TestProblem
- noTestsProblem :: TargetSelector -> TargetProblem TestProblem
- selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either TestTargetProblem [k]
- selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either TestTargetProblem k

# The `test` CLI and action

testCommand :: CommandUI (NixStyleFlags ()) #

testAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO () #

The `test` command is very much like `build`. It brings the install plan up to date, selects that part of the plan needed by the given or implicit test target(s) and then executes the plan.

Compared to `build` the difference is that there's also test targets which are ephemeral.

For more details on how this works, see the module Distribution.Client.ProjectOrchestration

# Internals exposed for testing

isSubComponentProblem :: PackageId -> ComponentName -> SubComponentTarget -> TargetProblem TestProblem #

notTestProblem :: PackageId -> ComponentName -> TargetProblem TestProblem #

noTestsProblem :: TargetSelector -> TargetProblem TestProblem #

selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either TestTargetProblem [k] #

This defines what a `TargetSelector` means for the `test` command. It selects the `AvailableTarget`s that the `TargetSelector` refers to, or otherwise classifies the problem.

For the `test` command we select all buildable test-suites, or fail if there are no test-suites or no buildable test-suites.

selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either TestTargetProblem k #

For a `TargetComponent` `TargetSelector`, check if the component can be selected.

For the `test` command we just need to check it is a test-suite, in addition to the basic checks on being buildable etc.