-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mis-parsing GraphQL identifiers when it starts with keywords (fix #20) (
#21) * Initial Bug Reproduction Test-Case * bug fix * Using existing nameparser functions instead of inclass * Adding Other Module for Testing * osx case-insensitive paths making renames difficult * Renaming file * File renaming shouldn't be this hard. * Adding comments and removing unused debugging code * removing un-needed hide * larger resource-class to allow builds again * add a workflow to run circleci tests Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com>
- Loading branch information
1 parent
088acdf
commit 1380495
Showing
6 changed files
with
144 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
-- | Regression tests for issue #20 https://github.com/hasura/graphql-parser-hs/issues/20 | ||
|
||
module Keywords (primitiveTests) where | ||
|
||
import Hedgehog | ||
import Protolude | ||
import GHC.Base (fail) | ||
|
||
import Language.GraphQL.Draft.Syntax | ||
import Language.GraphQL.Draft.Parser | ||
|
||
import qualified Language.GraphQL.Draft.Printer.Text as PP.TB | ||
import qualified Language.GraphQL.Draft.Printer as P | ||
|
||
primitiveTests :: IsString s => [(s, Property)] | ||
primitiveTests = | ||
[ ("property [ parse (print nameValue) == nameValue ]", propNullNameValue) | ||
, ("property [ parse (print nameBool) == nameBool ]", propBoolNameValue) | ||
, ("property [ parse (print nameName) == nameName ]", propNullNameName) | ||
] | ||
|
||
propNullNameValue :: Property | ||
propNullNameValue = property $ either (fail . Protolude.show) (ast ===) astRoundTrip | ||
where | ||
astRoundTrip = (runParser value) printed | ||
printed = PP.TB.render P.value ast | ||
ast = VList (ListValueG { unListValue = [ | ||
VEnum (EnumValue{unEnumValue = Name{unName = "nullColumn"}})]}) | ||
|
||
propBoolNameValue :: Property | ||
propBoolNameValue = property $ either (fail . Protolude.show) (ast ===) astRoundTrip | ||
where | ||
astRoundTrip = (runParser value) printed | ||
printed = PP.TB.render P.value ast | ||
ast = VList (ListValueG { unListValue = [ | ||
VEnum (EnumValue{unEnumValue = Name{unName = "trueColumn"}})]}) | ||
|
||
propNullNameName :: Property | ||
propNullNameName = property $ either (fail . Protolude.show) (ast ===) astRoundTrip | ||
where | ||
astRoundTrip = (runParser nameParser) printed | ||
printed = PP.TB.render P.nameP ast | ||
ast = Name "nullColumntwo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters