(t *testing.T)
| 247 | } |
| 248 | |
| 249 | func TestCustomType(t *testing.T) { |
| 250 | c := newFakeContext() |
| 251 | |
| 252 | // Fake out the adding of a task. |
| 253 | var task *taskqueue.Task |
| 254 | taskqueueAdder = func(_ context.Context, tk *taskqueue.Task, queue string) (*taskqueue.Task, error) { |
| 255 | if queue != "" { |
| 256 | t.Errorf(`Got queue %q, expected ""`, queue) |
| 257 | } |
| 258 | task = tk |
| 259 | return tk, nil |
| 260 | } |
| 261 | |
| 262 | for _, testTarget := range []*Function{custFunc, custRegister} { |
| 263 | custFTally = 0 // reset state |
| 264 | testTarget.Call(c.ctx, &CustomType{N: 11}, CustomImpl(13)) |
| 265 | |
| 266 | // Simulate the Task Queue service. |
| 267 | req, err := http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) |
| 268 | if err != nil { |
| 269 | t.Fatalf("Failed making http.Request: %v", err) |
| 270 | } |
| 271 | rw := httptest.NewRecorder() |
| 272 | runFunc(c.ctx, rw, req) |
| 273 | |
| 274 | if custFTally != 24 { |
| 275 | t.Errorf("custFTally = %d, want 24", custFTally) |
| 276 | } |
| 277 | |
| 278 | // Try the same, but with nil values; one is a nil pointer (and thus a non-nil interface value), |
| 279 | // and the other is a nil interface value. |
| 280 | custFTally = 0 // reset state |
| 281 | testTarget.Call(c.ctx, (*CustomType)(nil), nil) |
| 282 | |
| 283 | // Simulate the Task Queue service. |
| 284 | req, err = http.NewRequest("POST", path, bytes.NewBuffer(task.Payload)) |
| 285 | if err != nil { |
| 286 | t.Fatalf("Failed making http.Request: %v", err) |
| 287 | } |
| 288 | rw = httptest.NewRecorder() |
| 289 | runFunc(c.ctx, rw, req) |
| 290 | |
| 291 | if custFTally != 5 { |
| 292 | t.Errorf("custFTally = %d, want 5", custFTally) |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | func TestRunningVariadic(t *testing.T) { |
| 298 | c := newFakeContext() |
nothing calls this directly
no test coverage detected
searching dependent graphs…