From 8d81f43b611bd9624ab1ebfdb8c0cd9c2e4d9539 Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Mon, 14 Sep 2015 17:01:14 +0200 Subject: Add golden test for kitchen-sink.graphql --- tests/golden.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/golden.hs (limited to 'tests/golden.hs') diff --git a/tests/golden.hs b/tests/golden.hs new file mode 100644 index 0000000..e7ab70f --- /dev/null +++ b/tests/golden.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE OverloadedStrings #-} +module Main where + +import Control.Monad ((>=>)) +import Data.Attoparsec.Text (parseOnly) +import Data.ByteString.Lazy.Char8 as B8 +import qualified Data.Text.IO as TIO +import Test.Tasty (defaultMain) +import Test.Tasty.Golden (goldenVsString) + +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") + where + parse = fmap (parseOnly document) . TIO.readFile + >=> pure . either B8.pack (flip B8.snoc '\n' . B8.pack . show) + -- cgit v1.2.3