()
| 440 | } |
| 441 | |
| 442 | func (sc *StdoutCapture) StopCapture() (string, error) { |
| 443 | if sc.oldStdout == nil || sc.readPipe == nil { |
| 444 | return "", errors.New("StartCapture not called before StopCapture") |
| 445 | } |
| 446 | os.Stdout.Close() |
| 447 | os.Stdout = sc.oldStdout |
| 448 | bytes, err := io.ReadAll(sc.readPipe) |
| 449 | if err != nil { |
| 450 | return "", err |
| 451 | } |
| 452 | return string(bytes), nil |
| 453 | } |
| 454 | |
| 455 | func TestSuiteLogging(t *testing.T) { |
| 456 | suiteLoggingTester := new(SuiteLoggingTester) |