{-# OPTIONS_GHC -fno-warn-deprecations #-}
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
module Test.Hspec.Discover {-# WARNING
  "This module is used by @hspec-discover@.  It is not part of the public API and may change at any time."
  #-} (
  Spec
, hspec
#ifdef ENABLE_LEGACY_V1_FORMATTERS
, IsFormatter (..)
, hspecWithFormatter
#endif
, postProcessSpec
, describe
, module Prelude
) where

import           Test.Hspec.Core.Spec
import           Test.Hspec.Core.Runner
#ifdef ENABLE_LEGACY_V1_FORMATTERS
import           Test.Hspec.Core.Formatters.V1

class IsFormatter a where
  toFormatter :: a -> IO Formatter

instance IsFormatter (IO Formatter) where
  toFormatter :: IO Formatter -> IO Formatter
toFormatter = IO Formatter -> IO Formatter
forall a. a -> a
id

instance IsFormatter Formatter where
  toFormatter :: Formatter -> IO Formatter
toFormatter = Formatter -> IO Formatter
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return

hspecWithFormatter :: IsFormatter a => a -> Spec -> IO ()
hspecWithFormatter :: forall a. IsFormatter a => a -> Spec -> IO ()
hspecWithFormatter a
formatter Spec
spec = do
  f <- a -> IO Formatter
forall a. IsFormatter a => a -> IO Formatter
toFormatter a
formatter
  hspecWith defaultConfig {configFormatter = Just f} spec
#endif

postProcessSpec :: FilePath -> Spec -> Spec
postProcessSpec :: FilePath -> Spec -> Spec
postProcessSpec FilePath
_ = Spec -> Spec
forall a. a -> a
id