diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/golden.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/golden.hs b/tests/golden.hs index e7ab70f..98413eb 100644 --- a/tests/golden.hs +++ b/tests/golden.hs @@ -1,6 +1,10 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Main where +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>), (<*>), pure) +#endif import Control.Monad ((>=>)) import Data.Attoparsec.Text (parseOnly) import Data.ByteString.Lazy.Char8 as B8 @@ -8,14 +12,14 @@ import qualified Data.Text.IO as TIO import Test.Tasty (defaultMain) import Test.Tasty.Golden (goldenVsString) +import Paths_graphql (getDataFileName) import Data.GraphQL.Parser (document) main :: IO () main = defaultMain - $ goldenVsString "kitchen-sink.graphql" - "./tests/data/kitchen-sink.graphql.golden" - (parse "./tests/data/kitchen-sink.graphql") + =<< goldenVsString "kitchen-sink.graphql" + <$> getDataFileName "tests/data/kitchen-sink.graphql.graphql.golden" + <*> (parse <$> getDataFileName "tests/data/kitchen-sink.graphql") where parse = fmap (parseOnly document) . TIO.readFile >=> pure . either B8.pack (flip B8.snoc '\n' . B8.pack . show) - |
