Skip to content

{language/parser}: Updates test names for compatibility. #725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions language/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/graphql-go/graphql/language/source"
)

func TestBadToken(t *testing.T) {
func TestParser_BadToken(t *testing.T) {
_, err := Parse(ParseParams{
Source: &source.Source{
Body: []byte("query _ {\n me {\n id`\n }\n}"),
Expand All @@ -26,7 +26,7 @@ func TestBadToken(t *testing.T) {
}
}

func TestAcceptsOptionToNotIncludeSource(t *testing.T) {
func TestParser_AcceptsOptionToNotIncludeSource(t *testing.T) {
opts := ParseOptions{
NoSource: true,
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestAcceptsOptionToNotIncludeSource(t *testing.T) {
}
}

func TestParseProvidesUsefulErrors(t *testing.T) {
func TestParser_ParseProvidesUsefulErrors(t *testing.T) {
opts := ParseOptions{
NoSource: true,
}
Expand Down Expand Up @@ -135,7 +135,7 @@ fragment MissingOn Type

}

func TestParseProvidesUsefulErrorsWhenUsingSource(t *testing.T) {
func TestParser_ParseProvidesUsefulErrorsWhenUsingSource(t *testing.T) {
test := errorMessageTest{
source.NewSource(&source.Source{
Body: []byte("query"),
Expand All @@ -147,7 +147,7 @@ func TestParseProvidesUsefulErrorsWhenUsingSource(t *testing.T) {
testErrorMessage(t, test)
}

func TestParsesVariableInlineValues(t *testing.T) {
func TestParser_ParsesVariableInlineValues(t *testing.T) {
source := `{ field(complex: { a: { b: [ $var ] } }) }`
// should not return error
_, err := Parse(ParseParams{Source: source})
Expand All @@ -156,7 +156,7 @@ func TestParsesVariableInlineValues(t *testing.T) {
}
}

func TestParsesConstantDefaultValues(t *testing.T) {
func TestParser_ParsesConstantDefaultValues(t *testing.T) {
test := errorMessageTest{
`query Foo($x: Complex = { a: { b: [ $var ] } }) { field }`,
`Syntax Error GraphQL (1:37) Unexpected $`,
Expand All @@ -165,7 +165,7 @@ func TestParsesConstantDefaultValues(t *testing.T) {
testErrorMessage(t, test)
}

func TestDoesNotAcceptFragmentsNameOn(t *testing.T) {
func TestParser_DoesNotAcceptFragmentsNameOn(t *testing.T) {
test := errorMessageTest{
`fragment on on on { on }`,
`Syntax Error GraphQL (1:10) Unexpected Name "on"`,
Expand All @@ -174,7 +174,7 @@ func TestDoesNotAcceptFragmentsNameOn(t *testing.T) {
testErrorMessage(t, test)
}

func TestDoesNotAcceptFragmentsSpreadOfOn(t *testing.T) {
func TestParser_DoesNotAcceptFragmentsSpreadOfOn(t *testing.T) {
test := errorMessageTest{
`{ ...on }'`,
`Syntax Error GraphQL (1:9) Expected Name, found }`,
Expand All @@ -183,7 +183,7 @@ func TestDoesNotAcceptFragmentsSpreadOfOn(t *testing.T) {
testErrorMessage(t, test)
}

func TestDoesNotAllowNullAsValue(t *testing.T) {
func TestParser_DoesNotAllowNullAsValue(t *testing.T) {
test := errorMessageTest{
`{ fieldWithNullableStringInput(input: null) }'`,
`Syntax Error GraphQL (1:39) Unexpected Name "null"`,
Expand All @@ -192,7 +192,7 @@ func TestDoesNotAllowNullAsValue(t *testing.T) {
testErrorMessage(t, test)
}

func TestParsesMultiByteCharacters_Unicode(t *testing.T) {
func TestParser_ParsesMultiByteCharacters_Unicode(t *testing.T) {

doc := `
# This comment has a \u0A0A multi-byte character.
Expand Down Expand Up @@ -269,7 +269,7 @@ func TestParsesMultiByteCharacters_Unicode(t *testing.T) {
}
}

func TestParsesMultiByteCharacters_UnicodeText(t *testing.T) {
func TestParser_ParsesMultiByteCharacters_UnicodeText(t *testing.T) {

doc := `
# This comment has a фы世界 multi-byte character.
Expand Down Expand Up @@ -346,7 +346,7 @@ func TestParsesMultiByteCharacters_UnicodeText(t *testing.T) {
}
}

func TestParsesKitchenSink(t *testing.T) {
func TestParser_ParsesKitchenSink(t *testing.T) {
b, err := ioutil.ReadFile("../../kitchen-sink.graphql")
if err != nil {
t.Fatalf("unable to load kitchen-sink.graphql")
Expand All @@ -358,7 +358,7 @@ func TestParsesKitchenSink(t *testing.T) {
}
}

func TestAllowsNonKeywordsAnywhereNameIsAllowed(t *testing.T) {
func TestParser_AllowsNonKeywordsAnywhereNameIsAllowed(t *testing.T) {
nonKeywords := []string{
"on",
"fragment",
Expand Down Expand Up @@ -389,7 +389,7 @@ func TestAllowsNonKeywordsAnywhereNameIsAllowed(t *testing.T) {
}
}

func TestParsesExperimentalSubscriptionFeature(t *testing.T) {
func TestParser_ParsesExperimentalSubscriptionFeature(t *testing.T) {
source := `
subscription Foo {
subscriptionField
Expand All @@ -401,7 +401,7 @@ func TestParsesExperimentalSubscriptionFeature(t *testing.T) {
}
}

func TestParsesAnonymousMutationOperations(t *testing.T) {
func TestParser_ParsesAnonymousMutationOperations(t *testing.T) {
source := `
mutation {
mutationField
Expand All @@ -413,7 +413,7 @@ func TestParsesAnonymousMutationOperations(t *testing.T) {
}
}

func TestParsesAnonymousSubscriptionOperations(t *testing.T) {
func TestParser_ParsesAnonymousSubscriptionOperations(t *testing.T) {
source := `
subscription {
subscriptionField
Expand All @@ -425,7 +425,7 @@ func TestParsesAnonymousSubscriptionOperations(t *testing.T) {
}
}

func TestParsesNamedMutationOperations(t *testing.T) {
func TestParser_ParsesNamedMutationOperations(t *testing.T) {
source := `
mutation Foo {
mutationField
Expand All @@ -437,7 +437,7 @@ func TestParsesNamedMutationOperations(t *testing.T) {
}
}

func TestParsesNamedSubscriptionOperations(t *testing.T) {
func TestParser_ParsesNamedSubscriptionOperations(t *testing.T) {
source := `
subscription Foo {
subscriptionField
Expand All @@ -449,7 +449,7 @@ func TestParsesNamedSubscriptionOperations(t *testing.T) {
}
}

func TestParsesFieldDefinitionWithDescription(t *testing.T) {
func TestParser_ParsesFieldDefinitionWithDescription(t *testing.T) {
source := `
type Foo implements Bar {
"""
Expand All @@ -464,7 +464,7 @@ func TestParsesFieldDefinitionWithDescription(t *testing.T) {
}
}

func TestParsesInputValueDefinitionWithDescription(t *testing.T) {
func TestParser_ParsesInputValueDefinitionWithDescription(t *testing.T) {
source := `
type Foo implements Bar {
foo(
Expand All @@ -481,7 +481,7 @@ func TestParsesInputValueDefinitionWithDescription(t *testing.T) {
}
}

func TestParsesEnumValueDefinitionWithDescription(t *testing.T) {
func TestParser_ParsesEnumValueDefinitionWithDescription(t *testing.T) {
source := `
enum Site {
"description 1"
Expand All @@ -498,7 +498,7 @@ func TestParsesEnumValueDefinitionWithDescription(t *testing.T) {
}
}

func TestDefinitionsWithDescriptions(t *testing.T) {
func TestParser_DefinitionsWithDescriptions(t *testing.T) {
testCases := []struct {
name string
source string
Expand Down Expand Up @@ -609,7 +609,7 @@ func TestDefinitionsWithDescriptions(t *testing.T) {
}
}

func TestParseCreatesAst(t *testing.T) {
func TestParser_ParseCreatesAst(t *testing.T) {
body := `{
node(id: 4) {
id,
Expand Down Expand Up @@ -736,7 +736,7 @@ func TestParseCreatesAst(t *testing.T) {

}

func TestDoesNotAcceptStringAsDefinition(t *testing.T) {
func TestParser_DoesNotAcceptStringAsDefinition(t *testing.T) {
test := errorMessageTest{
`String`,
`Syntax Error GraphQL (1:1) Unexpected Name "String"`,
Expand Down