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

Function TestReceiverVarArgMacro

cel/macro_test.go:43–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestReceiverVarArgMacro(t *testing.T) {
44 noopExpander := func(meh MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) {
45 return nil, nil
46 }
47 varArgMacro := ReceiverVarArgMacro("varargs", noopExpander)
48 if varArgMacro.ArgCount() != 0 {
49 t.Errorf("ArgCount() got %d, wanted 0", varArgMacro.ArgCount())
50 }
51 if varArgMacro.Function() != "varargs" {
52 t.Errorf("Function() got %q, wanted 'varargs'", varArgMacro.Function())
53 }
54 if varArgMacro.MacroKey() != "varargs:*:true" {
55 t.Errorf("MacroKey() got %q, wanted 'varargs:*:true'", varArgMacro.MacroKey())
56 }
57 if !varArgMacro.IsReceiverStyle() {
58 t.Errorf("IsReceiverStyle() got %t, wanted true", varArgMacro.IsReceiverStyle())
59 }
60}
61
62func TestDocumentation(t *testing.T) {
63 noopExpander := func(meh MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) {

Callers

nothing calls this directly

Calls 5

ReceiverVarArgMacroFunction · 0.85
ArgCountMethod · 0.65
FunctionMethod · 0.65
MacroKeyMethod · 0.65
IsReceiverStyleMethod · 0.65

Tested by

no test coverage detected