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
helper
@ -100,8 +100,8 @@ func testHelper(t *testing.T,
|
||||
}
|
||||
})
|
||||
|
||||
if got := stdout.String(); !strings.HasPrefix(got, wantPayload) {
|
||||
t.Errorf("Start: stdout = %v, want %v",
|
||||
if got := stderr.String(); got != wantPayload {
|
||||
t.Errorf("Start: stderr = %v, want %v",
|
||||
got, wantPayload)
|
||||
}
|
||||
})
|
||||
@ -123,8 +123,8 @@ func testHelper(t *testing.T,
|
||||
err, stdout, stderr)
|
||||
}
|
||||
|
||||
if got := stdout.String(); !strings.HasPrefix(got, wantPayload) {
|
||||
t.Errorf("Start() stdout = %v, want %v",
|
||||
if got := stderr.String(); got != wantPayload {
|
||||
t.Errorf("Start() stderr = %v, want %v",
|
||||
got, wantPayload)
|
||||
}
|
||||
})
|
||||
|
@ -74,7 +74,7 @@ func flagRestoreFiles(offset int, ap, sp string) (argsFile, statFile *os.File) {
|
||||
func genericStub(argsFile, statFile *os.File) {
|
||||
if argsFile != nil {
|
||||
// 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())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user