(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestReceiverVarArgMacro(t *testing.T) { |
| 25 | noopExpander := func(meh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { |
| 26 | return nil, nil |
| 27 | } |
| 28 | varArgMacro := NewReceiverVarArgMacro("varargs", noopExpander, |
| 29 | MacroDocs(`convert variable argument lists to a list literal`), |
| 30 | MacroExamples(`varargs(1,2,3) // [1, 2, 3]`)) |
| 31 | if varArgMacro.ArgCount() != 0 { |
| 32 | t.Errorf("ArgCount() got %d, wanted 0", varArgMacro.ArgCount()) |
| 33 | } |
| 34 | if varArgMacro.Function() != "varargs" { |
| 35 | t.Errorf("Function() got %q, wanted 'varargs'", varArgMacro.Function()) |
| 36 | } |
| 37 | if varArgMacro.MacroKey() != "varargs:*:true" { |
| 38 | t.Errorf("MacroKey() got %q, wanted 'varargs:*:true'", varArgMacro.MacroKey()) |
| 39 | } |
| 40 | if !varArgMacro.IsReceiverStyle() { |
| 41 | t.Errorf("IsReceiverStyle() got %t, wanted true", varArgMacro.IsReceiverStyle()) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func TestDocumentation(t *testing.T) { |
| 46 | noopExpander := func(meh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { |
nothing calls this directly
no test coverage detected