MCPcopy Create free account
hub / github.com/cli/cli / TestOutputReturnsCommandOutput

Function TestOutputReturnsCommandOutput

git/command_test.go:34–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestOutputReturnsCommandOutput(t *testing.T) {
35 // Given a command that writes to standard output
36 cmd := createCommand(t, 0, "hello world", "")
37 command := Command{cmd}
38
39 // When its output is captured
40 out, err := command.Output()
41
42 // Then the output is returned without an error
43 require.NoError(t, err)
44 assert.Equal(t, "hello world", string(out))
45}
46
47func TestOutputReturnsGitError(t *testing.T) {
48 // Given a command that fails with Git's not-a-repository diagnostic

Callers

nothing calls this directly

Calls 3

OutputMethod · 0.95
createCommandFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected