MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestContainers_ToQualifiedName

Function TestContainers_ToQualifiedName

common/containers/container_test.go:249–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestContainers_ToQualifiedName(t *testing.T) {
250 fac := ast.NewExprFactory()
251 ident := fac.NewIdent(1, "var")
252 idName, found := ToQualifiedName(ident)
253 if !found {
254 t.Errorf("got not found from %v expr, wanted found", ident)
255 }
256 if idName != "var" {
257 t.Errorf("got %v, wanted 'var'", idName)
258 }
259 sel := fac.NewSelect(2, ident, "qualifier")
260 qualName, found := ToQualifiedName(sel)
261 if !found {
262 t.Errorf("got not found from %v expr, wanted found", sel)
263 }
264 if qualName != "var.qualifier" {
265 t.Errorf("got %v, wanted 'var.qualifier'", qualName)
266 }
267
268 pres := fac.NewPresenceTest(2, ident, "qualifier")
269 _, found = ToQualifiedName(pres)
270 if found {
271 t.Error("got found, wanted not found for test-only expression")
272 }
273
274 unary := fac.NewCall(2, "!_", ident)
275 sel = fac.NewSelect(3, unary, "qualifier")
276 _, found = ToQualifiedName(sel)
277 if found {
278 t.Errorf("got found, wanted not found for %v", sel)
279 }
280}

Callers

nothing calls this directly

Calls 7

NewIdentMethod · 0.95
NewSelectMethod · 0.95
NewPresenceTestMethod · 0.95
NewCallMethod · 0.95
NewExprFactoryFunction · 0.92
ToQualifiedNameFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected