Amend output of golden-tests to avoid confusion
parent
6008cb26ac
commit
47bcdb045b
|
@ -170,6 +170,8 @@ test-suite brittany-test-suite
|
|||
|
||||
build-depends:
|
||||
, hspec >= 2.8.3 && < 2.10
|
||||
, HUnit >= 1.6.2 && < 1.7
|
||||
, ansi-terminal >= 0.11.4 && < 0.12
|
||||
, parsec ^>= 3.1.14
|
||||
, these ^>= 1.1
|
||||
hs-source-dirs: source/test-suite
|
||||
|
|
|
@ -15,6 +15,7 @@ import Language.Haskell.Brittany.Internal
|
|||
import Language.Haskell.Brittany.Internal.Config.Config
|
||||
import Language.Haskell.Brittany.Internal.Config.Types
|
||||
import Language.Haskell.Brittany.Internal.Prelude
|
||||
import Test.HUnit (assertEqual)
|
||||
import qualified System.Directory
|
||||
import System.FilePath ((</>))
|
||||
import System.Timeout (timeout)
|
||||
|
@ -22,6 +23,7 @@ import Test.Hspec
|
|||
import qualified Text.Parsec as Parsec
|
||||
import Text.Parsec.Text (Parser)
|
||||
import qualified Data.List.Extra
|
||||
import qualified System.Console.ANSI as ANSI
|
||||
|
||||
hush :: Either a b -> Maybe b
|
||||
hush = either (const Nothing) Just
|
||||
|
@ -282,9 +284,15 @@ roundTripEqual c t =
|
|||
`shouldReturn` Right (PPTextWrapper t)
|
||||
|
||||
goldenTest :: Config -> Text -> Text -> Expectation
|
||||
goldenTest c input expected =
|
||||
fmap (fmap PPTextWrapper) (parsePrintModuleTests c "TestFakeFileName.hs" input)
|
||||
`shouldReturn` Right (PPTextWrapper expected)
|
||||
goldenTest c input expected = do
|
||||
result <- parsePrintModuleTests c "TestFakeFileName.hs" input
|
||||
assertEqual
|
||||
( ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground ANSI.Dull ANSI.Red]
|
||||
++ "golden input: see test source!"
|
||||
++ ANSI.setSGRCode [ANSI.Reset]
|
||||
)
|
||||
(Right (PPTextWrapper expected))
|
||||
(fmap PPTextWrapper result)
|
||||
|
||||
newtype PPTextWrapper = PPTextWrapper Text
|
||||
deriving Eq
|
||||
|
|
Loading…
Reference in New Issue