MCPcopy
hub / github.com/uber-go/zap / TestStub

Function TestStub

internal/exit/exit_test.go:30–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestStub(t *testing.T) {
31 type want struct {
32 exit bool
33 code int
34 }
35 tests := []struct {
36 f func()
37 want want
38 }{
39 {func() { exit.With(42) }, want{exit: true, code: 42}},
40 {func() {}, want{}},
41 }
42
43 for _, tt := range tests {
44 s := exit.WithStub(tt.f)
45 assert.Equal(t, tt.want.exit, s.Exited, "Stub captured unexpected exit value.")
46 assert.Equal(t, tt.want.code, s.Code, "Stub captured unexpected exit value.")
47 }
48}

Callers

nothing calls this directly

Calls 2

WithFunction · 0.92
WithStubFunction · 0.92

Tested by

no test coverage detected