MCPcopy Create free account
hub / github.com/Driver-C/tryssh / captureOutput

Function captureOutput

cmd/alias/alias_test.go:62–77  ·  view source on GitHub ↗
(t *testing.T, fn func())

Source from the content-addressed store, hash-verified

60}
61
62func captureOutput(t *testing.T, fn func()) string {
63 t.Helper()
64 old := os.Stdout
65 r, w, err := os.Pipe()
66 assert.NoError(t, err)
67 os.Stdout = w
68
69 fn()
70
71 w.Close()
72 os.Stdout = old
73
74 var buf bytes.Buffer
75 buf.ReadFrom(r)
76 return buf.String()
77}
78
79func TestNewAliasCommand_Structure(t *testing.T) {
80 cmd := NewAliasCommand()

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected