mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-11 16:24:11 +01:00
23 lines
422 B
Go
23 lines
422 B
Go
package capture
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestOutputMergesStdoutAndStderr(t *testing.T) {
|
|
got := Output(func() {
|
|
fmt.Print("out")
|
|
fmt.Fprint(stderrWriter(), "err") // write directly to stderr
|
|
})
|
|
if got != "outerr" {
|
|
t.Fatalf("unexpected combined output: %q", got)
|
|
}
|
|
}
|
|
|
|
// stderrWriter returns the current process stderr; split for test clarity.
|
|
func stderrWriter() *os.File {
|
|
return os.Stderr
|
|
}
|