darcs-2.18.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.UI.Commands.Test.Impl

Synopsis

- class Monad m => TestRunner (m :: Type -> Type -> Type -> Type) where
  - type ApplyPatchReqs (m :: Type -> Type -> Type -> Type) (p :: Type -> Type -> Type)
  - type DisplayPatchReqs (m :: Type -> Type -> Type -> Type) (p :: Type -> Type -> Type)
  - writeMsg :: String -> m wX wX ()
  - mentionPatch :: DisplayPatchReqs m p => p wA wB -> m wX wX ()
  - applyPatch :: ApplyPatchReqs m p => p wX wY -> m wX wY ()
  - unapplyPatch :: ApplyPatchReqs m p => p wX wY -> m wY wX ()
  - getCurrentTestResult :: m wX wX (TestResult wX)
  - finishedTesting :: a -> m wX TestingDone a
- runStrategy :: forall m (p :: Type -> Type -> Type) wOlder wNewer. TestablePatch m p => TestStrategy -> ShrinkFailure -> RL p wOlder wNewer -> m wNewer TestingDone (StrategyResultSealed p)
- data TestResult (wX :: k)
  - = Testable (TestResultValid wX)
  - | Untestable
- data TestResultValid (wX :: k)
  - = Success
  - | Failure (TestFailure wX)
- data TestFailure (wX :: k) = TestFailure Int
- data TestingDone
- data PatchSeq (p :: k -> k -> Type) (wX :: k) (wY :: k) where
  - Single :: forall {k} (p :: k -> k -> Type) (wX :: k) (wY :: k). p wX wY -> PatchSeq p wX wY
  - Joined :: forall {k} (p :: k -> k -> Type) (wX :: k) (wY1 :: k) (wY :: k). PatchSeq p wX wY1 -> PatchSeq p wY1 wY -> PatchSeq p wX wY
- patchTreeToFL :: forall (p :: Type -> Type -> Type) wX wY. PatchSeq p wX wY -> FL p wX wY
- type StrategyResult (p :: k -> k -> Type) (wSuccess :: k) (wFailure :: k) = StrategyResultRaw (PatchSeq p wSuccess wFailure)
- data StrategyResultRaw patches
  - = NoPasses
  - | NoFailureOnHead
  - | Blame patches
  - | RunSuccess
  - | RunFailed Int
- explanatoryTextFor :: TestStrategy -> String
- runTestingEnv :: TestingParams -> TestingEnv m wA TestingDone a -> m a
- exitCodeToTestResult :: forall {k} (wX :: k). ExitCode -> TestResult wX
- mkTestCmd :: (forall wX. IO (TestResult wX)) -> TestCmd
- runTestable :: forall (p :: Type -> Type -> Type) m wStart wA. (Commute p, TestRunner (TestingEnv m), TestRunnerPatchReqs (TestingEnv m) p) => SetScriptsExecutable -> TestCmd -> TestStrategy -> ShrinkFailure -> RL p wStart wA -> m (StrategyResultSealed p)

# Documentation

class Monad m => TestRunner (m :: Type -> Type -> Type -> Type) where #

An indexed monad that can be used to run tests. `TestingEnvIO` is the only real implementation, the unit tests for testing are based on mock implementations.

Associated Types

type ApplyPatchReqs (m :: Type -> Type -> Type -> Type) (p :: Type -> Type -> Type) #

type DisplayPatchReqs (m :: Type -> Type -> Type -> Type) (p :: Type -> Type -> Type) #

Methods

writeMsg :: String -> m wX wX () #

Output a message

mentionPatch :: DisplayPatchReqs m p => p wA wB -> m wX wX () #

Output a message containing the name of a patch

applyPatch :: ApplyPatchReqs m p => p wX wY -> m wX wY () #

Apply a patch to the testing tree.

unapplyPatch :: ApplyPatchReqs m p => p wX wY -> m wY wX () #

Unapply a patch from the testing tree

getCurrentTestResult :: m wX wX (TestResult wX) #

Get the current status (passskipfail) of the testing tree, e.g. by running the test command.

finishedTesting :: a -> m wX TestingDone a #

Flag that all testing has completed.

runStrategy :: forall m (p :: Type -> Type -> Type) wOlder wNewer. TestablePatch m p => TestStrategy -> ShrinkFailure -> RL p wOlder wNewer -> m wNewer TestingDone (StrategyResultSealed p) #

data TestResult (wX :: k) #

The result of running a test on state `wX` of the repository.

Constructors

Testable (TestResultValid wX) | We got a usable test result.
Untestable | The test result could not be identified as either pass or fail, for example it might have been a build failure. External test scripts report this by reporting exit code 125.

data TestResultValid (wX :: k) #

A usable test result, i.e. not an untestable state.

Constructors

Success | The test passed.
Failure (TestFailure wX) | The test failed with the given exit code.

data TestFailure (wX :: k) #

Constructors

TestFailure Int |

data TestingDone #

Once we've finished tracking down a test failure, we no longer care about tracking the actual state of the testing tree. This witness constant is never used in any patch, so once we use it for the state of the testing tree, in practice we can no longer do anything more with that tree.

We could also use some kind of existential or different monad type to represent this, but it would make composing code with 'do' harder.

data PatchSeq (p :: k -> k -> Type) (wX :: k) (wY :: k) where #

`PatchSeq` is a sequence of patches, implemented as a binary tree, balanced in an arbitrary way depending on how it happened to be constructed. In the 'darcs test' implementation it is used to wrap up a single patch or group of patches that might be the cause of a failure.

Constructors

Single :: forall {k} (p :: k -> k -> Type) (wX :: k) (wY :: k). p wX wY -> PatchSeq p wX wY |
Joined :: forall {k} (p :: k -> k -> Type) (wX :: k) (wY1 :: k) (wY :: k). PatchSeq p wX wY1 -> PatchSeq p wY1 wY -> PatchSeq p wX wY |

#### Instances

Instances details

Apply p => Apply (PatchSeq p) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Associated Types
type ApplyState (PatchSeq p) |
Instance details Defined in Darcs.UI.Commands.Test.Impl type ApplyState (PatchSeq p) = ApplyState p
Methods apply :: ApplyMonad (ApplyState (PatchSeq p)) m => PatchSeq p wX wY -> m () # unapply :: ApplyMonad (ApplyState (PatchSeq p)) m => PatchSeq p wX wY -> m () #
PatchInspect p => PatchInspect (PatchSeq p) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods listTouchedFiles :: PatchSeq p wX wY -> [AnchoredPath] # hunkMatches :: (ByteString -> Bool) -> PatchSeq p wX wY -> Bool #
Show2 p => Show2 (PatchSeq p) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods showDict2 :: ShowDict (PatchSeq p wX wY) #
Show2 p => Show1 (PatchSeq p wX) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods showDict1 :: Dict (Show (PatchSeq p wX wX0)) #
Show2 p => Show (PatchSeq p wX wY) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods showsPrec :: Int -> PatchSeq p wX wY -> ShowS # show :: PatchSeq p wX wY -> String # showList :: [PatchSeq p wX wY] -> ShowS #
type ApplyState (PatchSeq p) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl type ApplyState (PatchSeq p) = ApplyState p

patchTreeToFL :: forall (p :: Type -> Type -> Type) wX wY. PatchSeq p wX wY -> FL p wX wY #

type StrategyResult (p :: k -> k -> Type) (wSuccess :: k) (wFailure :: k) = StrategyResultRaw (PatchSeq p wSuccess wFailure) #

data StrategyResultRaw patches #

The result of running a test strategy.

Constructors

NoPasses | The chosen strategy didn't find any passing states in the repository.
NoFailureOnHead | The test didn't fail on head so there's no failure to track down.
Blame patches | The failure was tracked down to the given patches. these two are just for oneTest
RunSuccess | The single test run passed.
RunFailed Int | The single test run failed with the given exit code.

#### Instances

Instances details

Functor StrategyResultRaw # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods fmap :: (a -> b) -> StrategyResultRaw a -> StrategyResultRaw b # (<$) :: a -> StrategyResultRaw b -> StrategyResultRaw a #
Show patches => Show (StrategyResultRaw patches) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods showsPrec :: Int -> StrategyResultRaw patches -> ShowS # show :: StrategyResultRaw patches -> String # showList :: [StrategyResultRaw patches] -> ShowS #
Eq patches => Eq (StrategyResultRaw patches) # |
Instance details Defined in Darcs.UI.Commands.Test.Impl Methods (==) :: StrategyResultRaw patches -> StrategyResultRaw patches -> Bool # (/=) :: StrategyResultRaw patches -> StrategyResultRaw patches -> Bool #

explanatoryTextFor :: TestStrategy -> String #

runTestingEnv :: TestingParams -> TestingEnv m wA TestingDone a -> m a #

exitCodeToTestResult :: forall {k} (wX :: k). ExitCode -> TestResult wX #

mkTestCmd :: (forall wX. IO (TestResult wX)) -> TestCmd #

runTestable :: forall (p :: Type -> Type -> Type) m wStart wA. (Commute p, TestRunner (TestingEnv m), TestRunnerPatchReqs (TestingEnv m) p) => SetScriptsExecutable -> TestCmd -> TestStrategy -> ShrinkFailure -> RL p wStart wA -> m (StrategyResultSealed p) #