(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestVariadicFunctionArguments(t *testing.T) { |
| 145 | // Check the argument type validation for variadic functions. |
| 146 | |
| 147 | c := newFakeContext() |
| 148 | |
| 149 | calls := 0 |
| 150 | taskqueueAdder = func(c context.Context, t *taskqueue.Task, _ string) (*taskqueue.Task, error) { |
| 151 | calls++ |
| 152 | return t, nil |
| 153 | } |
| 154 | |
| 155 | varFunc.Call(c.ctx, "hi") |
| 156 | varFunc.Call(c.ctx, "%d", 12) |
| 157 | varFunc.Call(c.ctx, "%d %d %d", 3, 1, 4) |
| 158 | if calls != 3 { |
| 159 | t.Errorf("Got %d calls to taskqueueAdder, want 3", calls) |
| 160 | } |
| 161 | |
| 162 | if got, want := varFunc.Call(c.ctx, "%d %s", 12, "a string is bad"), errors.New("delay: argument 3 has wrong type: string is not assignable to int"); got.Error() != want.Error() { |
| 163 | t.Errorf("Incorrect error: got %q, want %q", got, want) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | func TestBadArguments(t *testing.T) { |
| 168 | // Try running regFunc with different sets of inappropriate arguments. |
nothing calls this directly
no test coverage detected
searching dependent graphs…