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

Function NewAttachedToInvocation

testutil/expecter/expecter.go:72–86  ·  view source on GitHub ↗
(t *testing.T, invocation *serpent.Invocation)

Source from the content-addressed store, hash-verified

70}
71
72func NewAttachedToInvocation(t *testing.T, invocation *serpent.Invocation) *Expecter {
73 r, w := io.Pipe()
74 invocation.Stdout = w
75 invocation.Stderr = w
76 e := New(t, r, "cmd")
77
78 t.Cleanup(func() {
79 // Serpent doesn't handle closing stdout after running the Invocation; normally the OS does that automatically when
80 // the process exits. Close it here at the end of the test to ensure we don't leak goroutines reading from the
81 // stdout/stderr.
82 _ = w.Close()
83 e.Close("test end")
84 })
85 return e
86}
87
88func NewPiped(t *testing.T) (*Expecter, io.Writer) {
89 r, w := io.Pipe()

Callers 1

TestFixOIDCLinksFunction · 0.92

Calls 3

NewFunction · 0.70
CleanupMethod · 0.65
CloseMethod · 0.65

Tested by 1

TestFixOIDCLinksFunction · 0.74