taffybar-4.1.1: A desktop bar similar to xmobar, but with more GUI
Safe HaskellNone
LanguageHaskell2010

System.Taffybar.Test.UtilSpec

Synopsis

Documentation

spec :: Spec Source #

Mock commands

withMockCommand Source #

Arguments

:: FilePath

Name of command - should not contain slashes

-> String

Contents of script

-> IO a

Action to run with command available in search path

-> IO a 

Run the given IO action with the PATH environment variable set up so that executing the given command name will run a script.

writeScript :: FilePath -> String -> IO () Source #

Write a text file, make it executable. It ought to have a shebang line.

Environment setup

withEnv :: [(String, Maybe String -> Maybe String)] -> IO a -> IO a Source #

Run an IO action with the given environment variables set up according to their current value. Nothing denotes an unset environment variable. After the IO action completes, environment variables are restored to their previous state.

withSetEnv :: [(String, String)] -> IO a -> IO a Source #

prependPath :: FilePath -> Maybe String -> Maybe String Source #

Use this as a modifier function argument of withEnv to ensure that the given directory is prepended to a search path variable.

Running subprocesses

withService :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a Source #

Like withProcessTerm_, except that if the process exits -- for whatever reason -- before the action completes, then it's an error. It will immediately cancel the action and throw an ExitCodeException.

setStdoutCond :: Priority -> ProcessConfig i o e -> ProcessConfig i () e Source #

setStderrCond :: Priority -> ProcessConfig i o e -> ProcessConfig i o () Source #

setServiceDefaults :: Priority -> ProcessConfig i o e -> ProcessConfig () () () Source #

makeServiceDefaults :: FilePath -> [String] -> IO (ProcessConfig () () ()) Source #

Concurrency

diffLiveThreads :: Eq a => [(a, b)] -> [(a, b)] -> [(a, b)] Source #

OS Resources

Other test helpers

tryIOMaybe :: MonadUnliftIO m => m a -> m (Maybe a) Source #

newtype DodgyEq a Source #

A wrapper to provide Eq for types which only have Show.

Constructors

DodgyEq 

Fields

Instances

Instances details
Show (DodgyEq a) Source # 
Instance details

Defined in System.Taffybar.Test.UtilSpec

Eq (DodgyEq a) Source # 
Instance details

Defined in System.Taffybar.Test.UtilSpec

Methods

(==) :: DodgyEq a -> DodgyEq a -> Bool Source #

(/=) :: DodgyEq a -> DodgyEq a -> Bool Source #

Logging for tests

logSetup :: HasCallStack => SpecWith a -> SpecWith a Source #

Setup logging before running the specs.

specLogSetup :: IO () Source #

Get log levels from environment variables and set up formatters.

specLogSetupPrio :: Priority -> IO () Source #

Like specLogSetup, but with a default minimum priority.

specLog :: MonadIO m => String -> m () Source #

Log a test message.

specLogAt :: MonadIO m => Priority -> String -> m () Source #

Log a test message at the given level.

getSpecLogPriority :: MonadIO m => m Priority Source #

Find out the configured log level for specs.

data Priority #

Instances

Instances details
NFData Priority 
Instance details

Defined in System.Log

Methods

rnf :: Priority -> () Source #

Data Priority 
Instance details

Defined in System.Log

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Priority -> c Priority Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Priority Source #

toConstr :: Priority -> Constr Source #

dataTypeOf :: Priority -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Priority) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Priority) Source #

gmapT :: (forall b. Data b => b -> b) -> Priority -> Priority Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Priority -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Priority -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Priority -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Priority -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Priority -> m Priority Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Priority -> m Priority Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Priority -> m Priority Source #

Bounded Priority 
Instance details

Defined in System.Log

Enum Priority 
Instance details

Defined in System.Log

Generic Priority 
Instance details

Defined in System.Log

Associated Types

type Rep Priority 
Instance details

Defined in System.Log

type Rep Priority = D1 ('MetaData "Priority" "System.Log" "hslogger-1.3.2.0-7InjwZUz8RN2lItqNTj9Ba" 'False) (((C1 ('MetaCons "DEBUG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "INFO" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NOTICE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WARNING" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ERROR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CRITICAL" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ALERT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EMERGENCY" 'PrefixI 'False) (U1 :: Type -> Type))))
Read Priority 
Instance details

Defined in System.Log

Show Priority 
Instance details

Defined in System.Log

Eq Priority 
Instance details

Defined in System.Log

Ord Priority 
Instance details

Defined in System.Log

type Rep Priority 
Instance details

Defined in System.Log

type Rep Priority = D1 ('MetaData "Priority" "System.Log" "hslogger-1.3.2.0-7InjwZUz8RN2lItqNTj9Ba" 'False) (((C1 ('MetaCons "DEBUG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "INFO" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NOTICE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WARNING" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ERROR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CRITICAL" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ALERT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EMERGENCY" 'PrefixI 'False) (U1 :: Type -> Type))))