photoprism/internal/util/capture_test.go
2019-05-06 23:18:10 +02:00

19 lines
266 B
Go

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