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

Add methods to access raw stdout/stderr logs #66

Closed
wants to merge 1 commit into from

Conversation

marcvinyals
Copy link
Contributor

I would like to test some code that writes raw binary data to stdout. To do so I believe I need access to the underlying byte array, since a sequence of bytes may not be a valid string. Therefore I suggest to add a method getLogBytes to SystemOutRule and SystemErrRule. Let me know if you think this makes sense and if so I will add documentation and tests to this PR.

@stefanbirkner
Copy link
Owner

Thanks for your contribution. I would like to add it to System Rules. Do you have time to write the tests for the new feature?

@stefanbirkner stefanbirkner added this to the 1.19.0 milestone Aug 5, 2018
@marcvinyals
Copy link
Contributor Author

I should be able to write some tests later this week.

@marcvinyals
Copy link
Contributor Author

I added a basic test that verifies properly handing non-utf-8 data. I would say that proper behaviour with respect to muting, etc. is well covered by the existing tests, do you think something more is needed?

@stefanbirkner
Copy link
Owner

Thanks for adding the test. I do my best to get a release out during next week.

stefanbirkner added a commit to marcvinyals/system-rules that referenced this pull request Nov 1, 2018
This is needed if your application does write binary data or text with a
specific charset.

Fixes stefanbirkner#66.
stefanbirkner added a commit to marcvinyals/system-rules that referenced this pull request Nov 3, 2018
SystemErrRule and SystemOutRule have a new method "getLogAsBytes" which
returns the raw bytes that have been written to System.err/System.out.
This is helpful if your application writes binary data or text with a
charset that is not the default charset.

Fixes stefanbirkner#66.
stefanbirkner added a commit to marcvinyals/system-rules that referenced this pull request Nov 6, 2018
SystemErrRule and SystemOutRule have a new method "getLogAsBytes" which
returns the raw bytes that have been written to System.err/System.out.
This is helpful if your application writes binary data or text with a
charset that is not the default charset.

Fixes stefanbirkner#66.
stefanbirkner added a commit to marcvinyals/system-rules that referenced this pull request Nov 11, 2018
SystemErrRule and SystemOutRule have a new method "getLogAsBytes" which
returns the raw bytes that have been written to System.err/System.out.
This method can be used for testing applications that write raw binary
data.

Fixes stefanbirkner#66.
SystemErrRule and SystemOutRule have a new method "getLogAsBytes" which
returns the raw bytes that have been written to System.err/System.out.
This method can be used for testing applications that write raw binary
data.

Fixes stefanbirkner#66.

Co-authored-by: Stefan Birkner <mail@stefan-birkner.de>
@stefanbirkner
Copy link
Owner

System Rules 1.19.0 adds a new method getLogAsBytes(): f4782eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants