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

Function TestOptionalHasValueVersion

cel/cel_test.go:4252–4273  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4250}
4251
4252func TestOptionalHasValueVersion(t *testing.T) {
4253 env := testEnv(t,
4254 OptionalTypes(OptionalTypesVersion(2)),
4255 // Test variables.
4256 Variable("x", OptionalType(IntType)),
4257 )
4258 if _, iss := env.Compile("x.hasValue()"); iss.Err() != nil {
4259 t.Errorf("hasValue() failed: %v", iss.Err())
4260 }
4261 _, iss := env.Compile("x.hasValue(1)")
4262 if iss.Err() == nil || !strings.Contains(iss.Err().Error(), "no matching overload for 'hasValue'") {
4263 t.Errorf("hasValue(1) got an unexpected result: %v", iss.Err())
4264 }
4265 env = testEnv(t,
4266 OptionalTypes(OptionalTypesVersion(3)),
4267 // Test variables.
4268 Variable("x", OptionalType(IntType)),
4269 )
4270 if _, iss := env.Compile("x.hasValue(1)"); iss.Err() != nil {
4271 t.Errorf("hasValue(1) failed: %v", iss.Err())
4272 }
4273}
4274
4275func TestOptionalMapVersion(t *testing.T) {
4276 commonOpts := []EnvOption{

Callers

nothing calls this directly

Calls 8

OptionalTypesFunction · 0.85
OptionalTypesVersionFunction · 0.85
ErrMethod · 0.80
testEnvFunction · 0.70
VariableFunction · 0.70
CompileMethod · 0.65
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected