MCPcopy
hub / github.com/grpc/grpc-go / BenchmarkCancelContextErrGotErr

Function BenchmarkCancelContextErrGotErr

benchmark/primitives/context_test.go:39–47  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

37}
38
39func BenchmarkCancelContextErrGotErr(b *testing.B) {
40 ctx, cancel := context.WithCancel(context.Background())
41 cancel()
42 for i := 0; i < b.N; i++ {
43 if err := ctx.Err(); err == nil {
44 b.Fatal("error")
45 }
46 }
47}
48
49func BenchmarkCancelContextChannelNoErr(b *testing.B) {
50 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 2

ErrMethod · 0.80
FatalMethod · 0.65

Tested by

no test coverage detected