2020-01-06 15:22:46 +01:00
|
|
|
package capture
|
2018-11-17 13:57:19 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2020-01-06 15:22:46 +01:00
|
|
|
func TestOutput(t *testing.T) {
|
|
|
|
result := Output(func() {
|
2018-11-17 13:57:19 +01:00
|
|
|
fmt.Fprint(os.Stdout, "foo")
|
|
|
|
fmt.Fprint(os.Stderr, "bar")
|
|
|
|
})
|
|
|
|
|
|
|
|
assert.Equal(t, "foobar", result)
|
|
|
|
}
|