sandwich-0.2.2.0: Yet another test framework for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Sandwich.Internal

Description

Internal functionality exposed for sibling libraries such as sandwich-webdriver to use. Should not be used otherwise.

Synopsis

Documentation

type Spec context m = SpecFree context m () Source #

type SpecFree context m a = Free (SpecCommand context m) a Source #

data SpecCommand context m next Source #

Instances

Instances details
Foldable (SpecCommand context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

fold :: Monoid m0 => SpecCommand context m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> SpecCommand context m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> SpecCommand context m a -> m0 #

foldr :: (a -> b -> b) -> b -> SpecCommand context m a -> b #

foldr' :: (a -> b -> b) -> b -> SpecCommand context m a -> b #

foldl :: (b -> a -> b) -> b -> SpecCommand context m a -> b #

foldl' :: (b -> a -> b) -> b -> SpecCommand context m a -> b #

foldr1 :: (a -> a -> a) -> SpecCommand context m a -> a #

foldl1 :: (a -> a -> a) -> SpecCommand context m a -> a #

toList :: SpecCommand context m a -> [a] #

null :: SpecCommand context m a -> Bool #

length :: SpecCommand context m a -> Int #

elem :: Eq a => a -> SpecCommand context m a -> Bool #

maximum :: Ord a => SpecCommand context m a -> a #

minimum :: Ord a => SpecCommand context m a -> a #

sum :: Num a => SpecCommand context m a -> a #

product :: Num a => SpecCommand context m a -> a #

Show1 (SpecCommand context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> SpecCommand context m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [SpecCommand context m a] -> ShowS #

Traversable (SpecCommand context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

traverse :: Applicative f => (a -> f b) -> SpecCommand context m a -> f (SpecCommand context m b) #

sequenceA :: Applicative f => SpecCommand context m (f a) -> f (SpecCommand context m a) #

mapM :: Monad m0 => (a -> m0 b) -> SpecCommand context m a -> m0 (SpecCommand context m b) #

sequence :: Monad m0 => SpecCommand context m (m0 a) -> m0 (SpecCommand context m a) #

Functor (SpecCommand context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

fmap :: (a -> b) -> SpecCommand context m a -> SpecCommand context m b #

(<$) :: a -> SpecCommand context m b -> SpecCommand context m a #

Show t => Show (SpecCommand context m t) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

showsPrec :: Int -> SpecCommand context m t -> ShowS #

show :: SpecCommand context m t -> String #

showList :: [SpecCommand context m t] -> ShowS #

class HasBaseContext a Source #

Has-* class for asserting a BaseContext is available.

Minimal complete definition

getBaseContext, modifyBaseContext

Instances

Instances details
HasBaseContext BaseContext Source # 
Instance details

Defined in Test.Sandwich.Types.RunTree

HasBaseContext context => HasBaseContext (intro :> context) Source # 
Instance details

Defined in Test.Sandwich.Types.RunTree

Methods

getBaseContext :: (intro :> context) -> BaseContext

modifyBaseContext :: (intro :> context) -> (BaseContext -> BaseContext) -> intro :> context

class HasLabel context (l :: Symbol) a Source #

Minimal complete definition

getLabelValue

Instances

Instances details
HasLabel (LabelValue l a :> context) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> (LabelValue l a :> context) -> a

HasLabel context l a => HasLabel (intro :> context) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> (intro :> context) -> a

HasLabel (LabelValue l a) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> LabelValue l a -> a

data LabelValue (l :: Symbol) a Source #

Constructors

LabelValue a 

Instances

Instances details
HasLabel (LabelValue l a :> context) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> (LabelValue l a :> context) -> a

HasLabel (LabelValue l a) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> LabelValue l a -> a

data (a :: Type) :> (b :: Type) infixr 9 Source #

Constructors

a :> b infixr 9 

Instances

Instances details
(Show a, Show b) => Show (a :> b) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

showsPrec :: Int -> (a :> b) -> ShowS #

show :: (a :> b) -> String #

showList :: [a :> b] -> ShowS #

HasBaseContext context => HasBaseContext (intro :> context) Source # 
Instance details

Defined in Test.Sandwich.Types.RunTree

Methods

getBaseContext :: (intro :> context) -> BaseContext

modifyBaseContext :: (intro :> context) -> (BaseContext -> BaseContext) -> intro :> context

HasLabel (LabelValue l a :> context) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> (LabelValue l a :> context) -> a

HasLabel context l a => HasLabel (intro :> context) l a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

getLabelValue :: Label l a -> (intro :> context) -> a

type ExampleM context = ExampleT context IO Source #

newtype ExampleT context m a Source #

Constructors

ExampleT 

Fields

Instances

Instances details
MonadBaseControl b m => MonadBaseControl b (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Associated Types

type StM (ExampleT context m) a #

Methods

liftBaseWith :: (RunInBase (ExampleT context m) b -> b a) -> ExampleT context m a #

restoreM :: StM (ExampleT context m) a -> ExampleT context m a #

Monad m => MonadReader context (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

ask :: ExampleT context m context #

local :: (context -> context) -> ExampleT context m a -> ExampleT context m a #

reader :: (context -> a) -> ExampleT context m a #

MonadBase b m => MonadBase b (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

liftBase :: b α -> ExampleT context m α #

MonadTransControl (ExampleT context) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Associated Types

type StT (ExampleT context) a #

Methods

liftWith :: Monad m => (Run (ExampleT context) -> m a) -> ExampleT context m a #

restoreT :: Monad m => m (StT (ExampleT context) a) -> ExampleT context m a #

MonadTrans (ExampleT context) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

lift :: Monad m => m a -> ExampleT context m a #

(Monad m, MonadThrow m) => MonadFail (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

fail :: String -> ExampleT context m a #

MonadIO m => MonadIO (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

liftIO :: IO a -> ExampleT context m a #

(Applicative m, Alternative (LoggingT m)) => Alternative (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

empty :: ExampleT context m a #

(<|>) :: ExampleT context m a -> ExampleT context m a -> ExampleT context m a #

some :: ExampleT context m a -> ExampleT context m [a] #

many :: ExampleT context m a -> ExampleT context m [a] #

Applicative m => Applicative (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

pure :: a -> ExampleT context m a #

(<*>) :: ExampleT context m (a -> b) -> ExampleT context m a -> ExampleT context m b #

liftA2 :: (a -> b -> c) -> ExampleT context m a -> ExampleT context m b -> ExampleT context m c #

(*>) :: ExampleT context m a -> ExampleT context m b -> ExampleT context m b #

(<*) :: ExampleT context m a -> ExampleT context m b -> ExampleT context m a #

Functor m => Functor (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

fmap :: (a -> b) -> ExampleT context m a -> ExampleT context m b #

(<$) :: a -> ExampleT context m b -> ExampleT context m a #

Monad m => Monad (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

(>>=) :: ExampleT context m a -> (a -> ExampleT context m b) -> ExampleT context m b #

(>>) :: ExampleT context m a -> ExampleT context m b -> ExampleT context m b #

return :: a -> ExampleT context m a #

MonadCatch m => MonadCatch (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

catch :: (HasCallStack, Exception e) => ExampleT context m a -> (e -> ExampleT context m a) -> ExampleT context m a #

MonadMask m => MonadMask (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

mask :: HasCallStack => ((forall a. ExampleT context m a -> ExampleT context m a) -> ExampleT context m b) -> ExampleT context m b #

uninterruptibleMask :: HasCallStack => ((forall a. ExampleT context m a -> ExampleT context m a) -> ExampleT context m b) -> ExampleT context m b #

generalBracket :: HasCallStack => ExampleT context m a -> (a -> ExitCase b -> ExampleT context m c) -> (a -> ExampleT context m b) -> ExampleT context m (b, c) #

MonadThrow m => MonadThrow (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

throwM :: (HasCallStack, Exception e) => e -> ExampleT context m a #

MonadIO m => MonadLogger (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ExampleT context m () #

MonadIO m => MonadLoggerIO (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

askLoggerIO :: ExampleT context m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) #

(MonadIO m, MonadUnliftIO m) => MonadUnliftIO (ExampleT context m) Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

Methods

withRunInIO :: ((forall a. ExampleT context m a -> IO a) -> IO b) -> ExampleT context m b #

type StT (ExampleT context) a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

type StT (ExampleT context) a = StT LoggingT (StT (ReaderT context) a)
type StM (ExampleT context m) a Source # 
Instance details

Defined in Test.Sandwich.Types.Spec

type StM (ExampleT context m) a = ComposeSt (ExampleT context) m a

data RunNodeWithStatus context s l t where Source #

Constructors

RunNodeBefore 

Fields

RunNodeAfter 

Fields

RunNodeIntroduce 

Fields

RunNodeIntroduceWith 

Fields

RunNodeAround 

Fields

RunNodeDescribe 

Fields

RunNodeParallel 

Fields

RunNodeIt 

Fields

type RunNodeFixed context = RunNodeWithStatus context Status (Seq LogEntry) Bool Source #

type RunNode context = RunNodeWithStatus context (Var Status) (Var (Seq LogEntry)) (Var Bool) Source #

extractValues :: (forall context. RunNodeWithStatus context s l t -> a) -> RunNodeWithStatus context s l t -> [a] Source #

extractValuesControlRecurse :: (forall context. RunNodeWithStatus context s l t -> (Bool, a)) -> RunNodeWithStatus context s l t -> [a] Source #

cancelNode :: RunNode context -> IO () Source #

fixRunTree :: RunNode context -> STM (RunNodeFixed context) Source #

waitForTree :: RunNode context -> IO Result Source #

Wait for a tree, catching any synchronous exceptions and returning them as a list

logEntryStr :: LogEntry -> LogStr Source #

countWhere :: (forall context. RunNodeWithStatus context s l t -> Bool) -> [RunNodeWithStatus context s l t] -> Int Source #

runWithRepeat :: Int -> Int -> IO (ExitReason, Int) -> IO () Source #

For 0 repeats, repeat until a failure

gatherNodeOptions :: Free (SpecCommand context m) r -> [NodeOptions] Source #

Gather all node options from a spec

gatherMainFunctions :: Free (SpecCommand context m) r -> [NodeModuleInfo] Source #

takenMainOptions :: [Text] Source #

TODO: get these automatically from mainCommandLineOptions

gatherShorthands :: [NodeModuleInfo] -> [(NodeModuleInfo, Text)] Source #