helper/stub: copy args to stderr
Some helpers are implemented via go test itself in tests, and as a result stdout gets clobbered. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
9f5dad1998
commit
891316d924
@ -100,8 +100,8 @@ func testHelper(t *testing.T,
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if got := stdout.String(); !strings.HasPrefix(got, wantPayload) {
|
if got := stderr.String(); got != wantPayload {
|
||||||
t.Errorf("Start: stdout = %v, want %v",
|
t.Errorf("Start: stderr = %v, want %v",
|
||||||
got, wantPayload)
|
got, wantPayload)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -123,8 +123,8 @@ func testHelper(t *testing.T,
|
|||||||
err, stdout, stderr)
|
err, stdout, stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if got := stdout.String(); !strings.HasPrefix(got, wantPayload) {
|
if got := stderr.String(); got != wantPayload {
|
||||||
t.Errorf("Start() stdout = %v, want %v",
|
t.Errorf("Start() stderr = %v, want %v",
|
||||||
got, wantPayload)
|
got, wantPayload)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -74,7 +74,7 @@ func flagRestoreFiles(offset int, ap, sp string) (argsFile, statFile *os.File) {
|
|||||||
func genericStub(argsFile, statFile *os.File) {
|
func genericStub(argsFile, statFile *os.File) {
|
||||||
if argsFile != nil {
|
if argsFile != nil {
|
||||||
// this output is checked by parent
|
// this output is checked by parent
|
||||||
if _, err := io.Copy(os.Stdout, argsFile); err != nil {
|
if _, err := io.Copy(os.Stderr, argsFile); err != nil {
|
||||||
panic("cannot read args: " + err.Error())
|
panic("cannot read args: " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user