(t *testing.T)
| 155 | } |
| 156 | |
| 157 | func TestVariadicFunctionArguments(t *testing.T) { |
| 158 | // Check the argument type validation for variadic functions. |
| 159 | c := newFakeContext() |
| 160 | |
| 161 | calls := 0 |
| 162 | taskqueueAdder = func(c context.Context, t *taskqueue.Task, _ string) (*taskqueue.Task, error) { |
| 163 | calls++ |
| 164 | return t, nil |
| 165 | } |
| 166 | |
| 167 | for _, testTarget := range []*Function{varFunc, varRegister} { |
| 168 | // reset state |
| 169 | calls = 0 |
| 170 | testTarget.Call(c.ctx, "hi") |
| 171 | testTarget.Call(c.ctx, "%d", 12) |
| 172 | testTarget.Call(c.ctx, "%d %d %d", 3, 1, 4) |
| 173 | if calls != 3 { |
| 174 | t.Errorf("Got %d calls to taskqueueAdder, want 3", calls) |
| 175 | } |
| 176 | |
| 177 | if got, want := testTarget.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() { |
| 178 | t.Errorf("Incorrect error: got %q, want %q", got, want) |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | func TestBadArguments(t *testing.T) { |
| 184 | // Try running regFunc with different sets of inappropriate arguments. |
nothing calls this directly
no test coverage detected
searching dependent graphs…