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

Function TestQualifierValueEquals

interpreter/attribute_patterns_test.go:388–500  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

386}
387
388func TestQualifierValueEquals(t *testing.T) {
389 tests := []struct {
390 name string
391 qualifier interface {
392 QualifierValueEquals(any) bool
393 }
394 cases []struct {
395 input any
396 want bool
397 }
398 }{
399 {
400 name: "fieldQualifier",
401 qualifier: &fieldQualifier{Name: "foo"},
402 cases: []struct {
403 input any
404 want bool
405 }{
406 {input: "foo", want: true},
407 {input: "bar", want: false},
408 {input: 123, want: false},
409 {input: true, want: false},
410 {input: nil, want: false},
411 },
412 },
413 {
414 name: "stringQualifier",
415 qualifier: &stringQualifier{value: "hello"},
416 cases: []struct {
417 input any
418 want bool
419 }{
420 {input: "hello", want: true},
421 {input: "world", want: false},
422 {input: 123, want: false},
423 {input: nil, want: false},
424 },
425 },
426 {
427 name: "boolQualifier",
428 qualifier: &boolQualifier{value: true},
429 cases: []struct {
430 input any
431 want bool
432 }{
433 {input: true, want: true},
434 {input: false, want: false},
435 {input: "true", want: false},
436 {input: 1, want: false},
437 {input: nil, want: false},
438 },
439 },
440 {
441 name: "intQualifier",
442 qualifier: &intQualifier{celValue: types.Int(42)},
443 cases: []struct {
444 input any
445 want bool

Callers

nothing calls this directly

Calls 4

IntTypeAlias · 0.92
DoubleTypeAlias · 0.92
UintTypeAlias · 0.92
QualifierValueEqualsMethod · 0.65

Tested by

no test coverage detected