photoprism/internal/util/capture_test.go

19 lines
266 B
Go
Raw Normal View History

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)
}