MCPcopy Create free account
hub / github.com/golang/appengine / TestVariadicFunctionArguments

Function TestVariadicFunctionArguments

delay/delay_test.go:144–165  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func 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
167func TestBadArguments(t *testing.T) {
168 // Try running regFunc with different sets of inappropriate arguments.

Callers

nothing calls this directly

Calls 3

newFakeContextFunction · 0.70
CallMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…