package capture import ( "fmt" "os" "testing" "github.com/stretchr/testify/assert" ) func TestOutput(t *testing.T) { result := Output(func() { fmt.Fprint(os.Stdout, "foo") fmt.Fprint(os.Stderr, "bar") }) assert.Equal(t, "foobar", result) }