MCPcopy Create free account
hub / github.com/vektah/gqlparser / TestQueryPosition

Function TestQueryPosition

parser/query_test.go:34–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestQueryPosition(t *testing.T) {
35 t.Run("query line number with comments", func(t *testing.T) {
36 query, err := ParseQuery(&ast.Source{
37 Input: `
38 # comment 1
39query SomeOperation {
40 # comment 2
41 myAction {
42 id
43 }
44}
45 `,
46 })
47 assert.NoError(t, err)
48 assert.Equal(t, 3, query.Operations.ForName("SomeOperation").Position.Line)
49 assert.Equal(
50 t,
51 5,
52 query.Operations.ForName("SomeOperation").SelectionSet[0].GetPosition().Line,
53 )
54 })
55}

Callers

nothing calls this directly

Calls 3

ParseQueryFunction · 0.85
GetPositionMethod · 0.65
ForNameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…