MCPcopy Index your code
hub / github.com/coder/coder / splitResp

Function splitResp

coderd/database/dbauthz/setup_test.go:410–428  ·  view source on GitHub ↗
(t *testing.T, values []reflect.Value)

Source from the content-addressed store, hash-verified

408}
409
410func splitResp(t *testing.T, values []reflect.Value) ([]reflect.Value, error) {
411 outputs := []reflect.Value{}
412 for _, r := range values {
413 if r.Type().Implements(reflect.TypeOf((*error)(nil)).Elem()) {
414 if r.IsNil() {
415 // Error is found, but it's nil!
416 return outputs, nil
417 }
418 err, ok := r.Interface().(error)
419 if !ok {
420 t.Fatal("error is not an error?!")
421 }
422 return outputs, err
423 }
424 outputs = append(outputs, r)
425 }
426 t.Fatal("no expected error value found in responses (error can be nil)")
427 return nil, nil // unreachable, required to compile
428}
429
430// expects is used to build a test case for a method.
431// It includes the expected inputs, rbac assertions, and expected outputs.

Callers 1

SubtestWithDBMethod · 0.85

Calls 2

FatalMethod · 0.80
TypeMethod · 0.65

Tested by

no test coverage detected