module Test.Fluent.Internal.AssertionConfig where

newtype AssertionConfig = AssertionConfig
  { AssertionConfig -> Int
assertionTimeout :: Int
  }
  deriving (Int -> AssertionConfig -> ShowS
[AssertionConfig] -> ShowS
AssertionConfig -> String
(Int -> AssertionConfig -> ShowS)
-> (AssertionConfig -> String)
-> ([AssertionConfig] -> ShowS)
-> Show AssertionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssertionConfig] -> ShowS
$cshowList :: [AssertionConfig] -> ShowS
show :: AssertionConfig -> String
$cshow :: AssertionConfig -> String
showsPrec :: Int -> AssertionConfig -> ShowS
$cshowsPrec :: Int -> AssertionConfig -> ShowS
Show)

-- | Default configuration used for `assertThat` and `assertThatIO`.
-- - default timeout is set to 5 seconds
defaultConfig :: AssertionConfig
defaultConfig :: AssertionConfig
defaultConfig =
  Int -> AssertionConfig
AssertionConfig
    Int
5000000 -- 5 seconds

-- | Allow to modify timeout of single assertion
setAssertionTimeout :: Int -> AssertionConfig -> AssertionConfig
setAssertionTimeout :: Int -> AssertionConfig -> AssertionConfig
setAssertionTimeout Int
newTimeout AssertionConfig
config = AssertionConfig
config {assertionTimeout :: Int
assertionTimeout = Int
newTimeout}