{-|
Description : A custom hspec formatter for easy-to-read terminal output.
License     : MIT
-}

module Test.Hspec.TidyFormatter
(
  -- * Formatter
  use
, register
, formatter

  -- * Re-exported API
, module Test.Hspec.Api.Formatters.V3

) where


import Test.Hspec.TidyFormatter.Internal qualified as Internal
import Test.Hspec.Api.Formatters.V3


-- | Use the formatter by default. Also makes it available for selection with @hspec --format=tidy@.
use :: SpecWith () -> SpecWith ()
use :: SpecWith () -> SpecWith ()
use = ((Config -> Config) -> SpecWith ()
forall a. (Config -> Config) -> SpecWith a
modifyConfig ((String, Formatter) -> Config -> Config
useFormatter (String, Formatter)
formatter) >>)

-- | Make the formatter available for selection with @hspec --format=tidy@.
register :: SpecWith a -> SpecWith a
register :: forall a. SpecWith a -> SpecWith a
register = ((Config -> Config) -> SpecWith a
forall a. (Config -> Config) -> SpecWith a
modifyConfig ((String, Formatter) -> Config -> Config
registerFormatter (String, Formatter)
formatter) >>)

-- | The named formatter.
formatter :: (String,Formatter)
formatter :: (String, Formatter)
formatter = (String
name,Formatter
Internal.tidy)


--
-- non-exported
--

name :: String
name :: String
name = String
"tidy"