Fix failed parsing on multiple required arguments

Fixes #25.
This commit is contained in:
Sam Nolan 2019-11-19 19:41:52 +11:00 committed by Eugen Wissner
parent 7b92e5bcfd
commit 73e21661b4
3 changed files with 12 additions and 6 deletions

View File

@ -89,12 +89,12 @@ symbol :: T.Text -> Parser T.Text
symbol = Lexer.symbol spaceConsumer
-- | Parser for "!".
bang :: Parser Char
bang = char '!'
bang :: Parser T.Text
bang = symbol "!"
-- | Parser for "$".
dollar :: Parser Char
dollar = char '$'
dollar :: Parser T.Text
dollar = symbol "$"
-- | Parser for "@".
at :: Parser Char

View File

@ -71,8 +71,8 @@ spec = describe "Lexer" $ do
parse float "" "-1.123e4567" `shouldParse` (-1.123e4567)
it "lexes punctuation" $ do
parse bang "" "!" `shouldParse` '!'
parse dollar "" "$" `shouldParse` '$'
parse bang "" "!" `shouldParse` "!"
parse dollar "" "$" `shouldParse` "$"
runBetween parens `shouldSucceedOn` "()"
parse spread "" "..." `shouldParse` "..."
parse colon "" ":" `shouldParse` ":"

View File

@ -24,3 +24,9 @@ spec = describe "Parser" $ do
parse document "" `shouldSucceedOn` [r|{
hello(text: "Argument")
}|]
it "accepts two required arguments" $
parse document "" `shouldSucceedOn` [r|
mutation auth($username: String!, $password: String!){
test
}|]