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 symbol = Lexer.symbol spaceConsumer
-- | Parser for "!". -- | Parser for "!".
bang :: Parser Char bang :: Parser T.Text
bang = char '!' bang = symbol "!"
-- | Parser for "$". -- | Parser for "$".
dollar :: Parser Char dollar :: Parser T.Text
dollar = char '$' dollar = symbol "$"
-- | Parser for "@". -- | Parser for "@".
at :: Parser Char at :: Parser Char

View File

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

View File

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