Skip to content

Commit 0f75283

Browse files
committed
Add details when a process exits unexpectedly during a test
1 parent d106e62 commit 0f75283

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

main_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ func (s *Suite) RunMain(expectedExitCode int, argv ...string) (stdout, stderr st
9898
var errBuf bytes.Buffer
9999

100100
actualExitCode := gobcoMain(&outBuf, &errBuf, argv...)
101+
stdout = outBuf.String()
102+
stderr = errBuf.String()
101103

102-
s.CheckEquals(actualExitCode, expectedExitCode)
103-
104-
return outBuf.String(), errBuf.String()
104+
if actualExitCode != expectedExitCode {
105+
s.t.Errorf("expected exit code %+#v, got %+#v with stdout \"%s\" and stderr \"%s\"",
106+
expectedExitCode, actualExitCode, stdout, stderr)
107+
}
108+
return
105109
}
106110

107111
// GobcoLines extracts and normalizes the relevant lines from the output of

0 commit comments

Comments
 (0)