2019-07-22 05:50:00 +02:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2019-09-06 07:48:01 +02:00
|
|
|
{-# LANGUAGE QuasiQuotes #-}
|
2019-11-03 10:42:10 +01:00
|
|
|
module Language.GraphQL.AST.ParserSpec
|
2019-07-22 05:50:00 +02:00
|
|
|
( spec
|
|
|
|
) where
|
|
|
|
|
2019-11-03 10:42:10 +01:00
|
|
|
import Language.GraphQL.AST.Parser
|
2019-09-27 10:50:38 +02:00
|
|
|
import Test.Hspec (Spec, describe, it)
|
|
|
|
import Test.Hspec.Megaparsec (shouldSucceedOn)
|
2019-07-22 05:50:00 +02:00
|
|
|
import Text.Megaparsec (parse)
|
2019-09-06 07:48:01 +02:00
|
|
|
import Text.RawString.QQ (r)
|
2019-07-22 05:50:00 +02:00
|
|
|
|
|
|
|
spec :: Spec
|
2019-09-06 07:48:01 +02:00
|
|
|
spec = describe "Parser" $ do
|
2019-07-22 05:50:00 +02:00
|
|
|
it "accepts BOM header" $
|
2019-09-27 10:50:38 +02:00
|
|
|
parse document "" `shouldSucceedOn` "\xfeff{foo}"
|
2019-09-06 07:48:01 +02:00
|
|
|
|
|
|
|
it "accepts block strings as argument" $
|
2019-09-27 10:50:38 +02:00
|
|
|
parse document "" `shouldSucceedOn` [r|{
|
2019-09-06 07:48:01 +02:00
|
|
|
hello(text: """Argument""")
|
2019-09-27 10:50:38 +02:00
|
|
|
}|]
|
2019-09-06 07:48:01 +02:00
|
|
|
|
|
|
|
it "accepts strings as argument" $
|
2019-09-27 10:50:38 +02:00
|
|
|
parse document "" `shouldSucceedOn` [r|{
|
2019-09-06 07:48:01 +02:00
|
|
|
hello(text: "Argument")
|
2019-09-27 10:50:38 +02:00
|
|
|
}|]
|