Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture output stream (stdout/stderr) #7

Open
joshiayush opened this issue Oct 12, 2022 · 0 comments
Open

Capture output stream (stdout/stderr) #7

joshiayush opened this issue Oct 12, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@joshiayush
Copy link
Owner

At the moment, we don't have any API that can also capture the output streams (stdout/stderr), so even to test our own xtest API we have to use the redirector API that we have inside of our tests which is not completely efficient. So, what I have decided to do is to implement a CapturedStream API similar to the one that googletest uses.

Problems with RedirectorContext:

  • We have to explicitly pass the type of the stream we want to capture.
  • We have to manually replace the stream file with our own context buffer.
  • We also have to restore the stream manually.

What googletest have for us:

  • Simplicity; (following example is taken from the cjson library).

    testing::internal::CaptureStdout();
    PrintSstream(&sstream, FALSE);
    std::string stdout_output = testing::internal::GetCapturedStdout();
@joshiayush joshiayush added the enhancement New feature or request label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant