mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-11 16:24:11 +01:00
Tests: Add pkg/capture/capture_test.go #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
22
pkg/capture/capture_test.go
Normal file
22
pkg/capture/capture_test.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user