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

Function TestValidatorConfigValue

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

Source from the content-addressed store, hash-verified

1430}
1431
1432func TestValidatorConfigValue(t *testing.T) {
1433 var v *Validator
1434 if _, found := v.ConfigValue("limit"); found {
1435 t.Error("v.ConfigValue() got value from nil validator")
1436 }
1437 v = NewValidator("validator").SetConfig(map[string]any{"limit": 2})
1438 if _, found := v.ConfigValue("absent"); found {
1439 t.Error("v.ConfigValue() found absent key")
1440 }
1441 if val, found := v.ConfigValue("limit"); !found || val != 2 {
1442 t.Errorf("v.ConfigValue() got %v, %t -- wanted 2, true", val, found)
1443 }
1444}
1445
1446func TestFeatureValidate(t *testing.T) {
1447 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