MCPcopy
hub / github.com/dgraph-io/dgraph / TestDuplicateQueryAliasesError

Function TestDuplicateQueryAliasesError

dql/parser_test.go:116–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestDuplicateQueryAliasesError(t *testing.T) {
117 query := `
118{
119 find_michael(func: eq(name@., "Michael")) {
120 uid
121 name@.
122 age
123 }
124 find_michael(func: eq(name@., "Amit")) {
125 uid
126 name@.
127 }
128}`
129 _, err := Parse(Request{Str: query})
130 require.Error(t, err)
131
132 queryInOpType := `
133{
134 find_michael(func: eq(name@., "Michael")) {
135 uid
136 name@.
137 age
138 }
139}
140query {find_michael(func: eq(name@., "Amit")) {
141 uid
142 name@.
143 }
144}
145`
146 _, err = Parse(Request{Str: queryInOpType})
147 require.Error(t, err)
148
149 queryWithDuplicateShortestPaths := `
150{
151 path as shortest(from: 0x1, to: 0x4) {
152 friend
153 }
154 path2 as shortest(from: 0x2, to: 0x3) {
155 friend
156 }
157 pathQuery1(func: uid(path)) {
158 name
159 }
160 pathQuery2(func: uid(path2)) {
161 name
162 }
163
164}`
165 _, err = Parse(Request{Str: queryWithDuplicateShortestPaths})
166 require.NoError(t, err)
167}
168
169func TestParseQueryListPred1(t *testing.T) {
170 query := `

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected