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

Function TestValidatorConfigValue

common/env/env_test.go:1539–1551  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1537}
1538
1539func TestValidatorConfigValue(t *testing.T) {
1540 var v *Validator
1541 if _, found := v.ConfigValue("limit"); found {
1542 t.Error("v.ConfigValue() got value from nil validator")
1543 }
1544 v = NewValidator("validator").SetConfig(map[string]any{"limit": 2})
1545 if _, found := v.ConfigValue("absent"); found {
1546 t.Error("v.ConfigValue() found absent key")
1547 }
1548 if val, found := v.ConfigValue("limit"); !found || val != 2 {
1549 t.Errorf("v.ConfigValue() got %v, %t -- wanted 2, true", val, found)
1550 }
1551}
1552
1553func TestFeatureValidate(t *testing.T) {
1554 tests := []struct {

Callers

nothing calls this directly

Calls 4

ConfigValueMethod · 0.95
NewValidatorFunction · 0.85
SetConfigMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected