9872cfaa50
- Includes refactoring of existing packages to enable testing of commands
18 lines
254 B
Go
18 lines
254 B
Go
package test
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCapture(t *testing.T) {
|
|
result := Capture(func() {
|
|
fmt.Fprint(os.Stdout, "foo")
|
|
fmt.Fprint(os.Stderr, "bar")
|
|
})
|
|
|
|
assert.Equal(t, "foobar", result)
|
|
}
|