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