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

Function TestNilFunction

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

Source from the content-addressed store, hash-verified

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