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

Function TestCloserStack_Mainline

cli/ssh_internal_test.go:76–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestCloserStack_Mainline(t *testing.T) {
77 t.Parallel()
78 ctx := testutil.Context(t, testutil.WaitShort)
79 logger := testutil.Logger(t)
80 uut := newCloserStack(ctx, logger, quartz.NewMock(t))
81 closes := new([]*fakeCloser)
82 fc0 := &fakeCloser{closes: closes}
83 fc1 := &fakeCloser{closes: closes}
84
85 func() {
86 defer uut.close(nil)
87 err := uut.push("fc0", fc0)
88 require.NoError(t, err)
89 err = uut.push("fc1", fc1)
90 require.NoError(t, err)
91 }()
92 // order reversed
93 require.Equal(t, []*fakeCloser{fc1, fc0}, *closes)
94}
95
96func TestCloserStack_Empty(t *testing.T) {
97 t.Parallel()

Callers

nothing calls this directly

Calls 6

ContextFunction · 0.92
LoggerFunction · 0.92
newCloserStackFunction · 0.85
pushMethod · 0.80
closeMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected