diff options
Diffstat (limited to 'tests/tasty.hs')
| -rw-r--r-- | tests/tasty.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/tasty.hs b/tests/tasty.hs new file mode 100644 index 0000000..a034a79 --- /dev/null +++ b/tests/tasty.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE OverloadedStrings #-} +module Main where + +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>), (<*>)) +#endif + +import Data.Attoparsec.Text (parseOnly) +import qualified Data.Text.IO as Text +import Test.Tasty (defaultMain) +import Test.Tasty.HUnit + +import qualified Data.GraphQL.Parser as Parser +import qualified Data.GraphQL.Encoder as Encoder + +import Paths_graphql (getDataFileName) + +main :: IO () +main = defaultMain =<< testCase "Kitchen Sink" + <$> (assertEqual "Encode" <$> expected <*> actual) + where + expected = Text.readFile + =<< getDataFileName "tests/data/kitchen-sink.min.graphql" + + actual = either (error "Parsing error!") Encoder.document + <$> parseOnly Parser.document + <$> expected |
