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

Function TestNilFunction

common/decls/decls_test.go:1324–1354  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1322}
1323
1324func TestNilFunction(t *testing.T) {
1325 var f *FunctionDecl
1326 if f.Name() != "" {
1327 t.Errorf("f.Name() got %s, wanted ''", f.Name())
1328 }
1329 if f.Description() != "" {
1330 t.Errorf("f.Description() got %s, wanted ''", f.Description())
1331 }
1332 if f.Documentation() != nil {
1333 t.Errorf("f.Documentation() got %v, wanted nil", f.Documentation())
1334 }
1335 if !f.IsDeclarationDisabled() {
1336 t.Errorf("f.IsDeclarationDisabled() got %t, wanted true", f.IsDeclarationDisabled())
1337 }
1338 if len(f.OverloadDecls()) != 0 {
1339 t.Errorf("f.OverloadDecls() got %d overloads, wanted 0", len(f.OverloadDecls()))
1340 }
1341 if b, err := f.Bindings(); err != nil || len(b) != 0 {
1342 t.Error("f.Bindings() got non-empty result")
1343 }
1344 other := &FunctionDecl{}
1345 if fn, err := f.Merge(other); err == nil {
1346 t.Errorf("f.Merge(nil) wanted error, got %v", fn)
1347 }
1348 if err := f.AddOverload(nil); err == nil {
1349 t.Error("f.AddOverload(nil) did not error")
1350 }
1351 if err := other.AddOverload(nil); err == nil {
1352 t.Error("f.AddOverload(nil) did not error")
1353 }
1354}
1355
1356func TestNilVariable(t *testing.T) {
1357 var v *VariableDecl

Callers

nothing calls this directly

Calls 9

NameMethod · 0.95
DescriptionMethod · 0.95
DocumentationMethod · 0.95
IsDeclarationDisabledMethod · 0.95
OverloadDeclsMethod · 0.95
BindingsMethod · 0.95
MergeMethod · 0.95
AddOverloadMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected