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
- 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 Source #
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) Source #
type DisplayPatchReqs (m :: Type -> Type -> Type -> Type) (p :: Type -> Type -> Type) Source #
Methods
writeMsg :: String -> m wX wX () Source #
Output a message
mentionPatch :: DisplayPatchReqs m p => p wA wB -> m wX wX () Source #
Output a message containing the name of a patch
applyPatch :: ApplyPatchReqs m p => p wX wY -> m wX wY () Source #
Apply a patch to the testing tree.
unapplyPatch :: ApplyPatchReqs m p => p wX wY -> m wY wX () Source #
Unapply a patch from the testing tree
getCurrentTestResult :: m wX wX (TestResult wX) Source #
Get the current status (passskipfail) of the testing tree, e.g. by running the test command.
finishedTesting :: a -> m wX TestingDone a Source #
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) Source #
data TestResult (wX :: k) Source #
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) Source #
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) Source #
Constructors
TestFailure Int |
data TestingDone Source #
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 Source #
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
Apply p => Apply (PatchSeq p) Source # | |||||
Defined in Darcs.UI.Commands.Test.Impl Associated Types
Methods apply :: ApplyMonad (ApplyState (PatchSeq p)) m => PatchSeq p wX wY -> m () Source # unapply :: ApplyMonad (ApplyState (PatchSeq p)) m => PatchSeq p wX wY -> m () Source # | |||||
PatchInspect p => PatchInspect (PatchSeq p) Source # | |||||
Defined in Darcs.UI.Commands.Test.Impl Methods listTouchedFiles :: PatchSeq p wX wY -> [AnchoredPath] Source # hunkMatches :: (ByteString -> Bool) -> PatchSeq p wX wY -> Bool Source # | |||||
Show2 p => Show2 (PatchSeq p) Source # | |||||
Defined in Darcs.UI.Commands.Test.Impl | |||||
Show2 p => Show1 (PatchSeq p wX) Source # | |||||
Show2 p => Show (PatchSeq p wX wY) Source # | |||||
type ApplyState (PatchSeq p) Source # | |||||
Defined in Darcs.UI.Commands.Test.Impl |
patchTreeToFL :: forall (p :: Type -> Type -> Type) wX wY. PatchSeq p wX wY -> FL p wX wY Source #
type StrategyResult (p :: k -> k -> Type) (wSuccess :: k) (wFailure :: k) = StrategyResultRaw (PatchSeq p wSuccess wFailure) Source #
data StrategyResultRaw patches Source #
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
Functor StrategyResultRaw Source # | |
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) Source # | |
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) Source # | |
Defined in Darcs.UI.Commands.Test.Impl Methods (==) :: StrategyResultRaw patches -> StrategyResultRaw patches -> Bool # (/=) :: StrategyResultRaw patches -> StrategyResultRaw patches -> Bool # |
runTestingEnv :: TestingParams -> TestingEnv m wA TestingDone a -> m a Source #
exitCodeToTestResult :: forall {k} (wX :: k). ExitCode -> TestResult wX Source #
mkTestCmd :: (forall wX. IO (TestResult wX)) -> TestCmd Source #
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) Source #