forked from ztombol/bats-assert
-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add assert_stderr, refute_stderr, assert_stderr_line #72
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactor the `assert_output` function to improve clarity and maintainability. Introduce a new helper function `__assert_stream` to handle different stream types (output and stderr).
Introduce the `assert_stderr` function to validate that the standard error output matches the expected value.
Refactor the `refute_output` function to improve stream handling by introducing a new `__refute_stream` function. This change allows for more flexible handling of both `output` and `stderr` streams. This enhances the maintainability and usability of the code.
Introduce the `refute_stderr` function to allow verification that a command or function does not produce unexpected stderr. This function complements `assert_stderr` and supports matching via literal, partial, or regular expression. Update documentation to reflect this addition and clarify usage of `assert_stderr` with `--separate-stderr` for proper stderr handling.
Refactor the `assert_line` function to improve clarity and maintainability. Introduce a new helper function `__assert_stream_line` to handle different stream types (output and stderr).
Add a new assert_stderr_line function for checking expected lines in the stderr output. This improves the clarity and functionality of the assertion process.
Introduce a new helper function `__refute_stream_line` to streamline the logic and reduce code duplication.
Refactor the `refute_line` function to handle both output and stderr streams uniformly. Introduce a new helper function `__refute_stream_line` to streamline the logic and reduce code duplication. Introduce the `refute_stderr_line` function to verify that an unexpected line does not appear in the stderr output. Update documentation to reflect usage and necessary conditions for correct operation, including the requirement to use `--separate-stderr` when running commands.
it seems a great work, however I can't approve the workflow to see the tests @bats-core/bats-core can someone approve thew workflow? or give me the grants to do it for this repo as well, thanks! |
martin-schulze-vireso
approved these changes
Mar 19, 2025
Add tests for `__refute_stream_line`, `__assert_stream`, and `__assert_line` to ensure they produce appropriate error messages when called directly. Update the implementations to handle unexpected calls by providing clear guidance on correct usage. This improves user experience and debugging by preventing silent failures and clarifying intended function usage.
Thanks for your contribution. |
Thanks for your work you do with bats. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request closes #42. It addresses the shortcoming of PR #52 reducing the code duplication.
Refactor the
assert_output
function to improve clarity and maintainability. Introduce a new helper function__assert_stream
to handle different stream types (output and stderr).Introduce the
assert_stderr
function to validate that the standard error output matches the expected value.Refactor the
refute_output
function to improve stream handling by introducing a new__refute_stream
function. This change allows for more flexible handling of bothoutput
andstderr
streams. This enhances the maintainability and usability of the code.Introduce the
refute_stderr
function to allow verification that a command or function does not produce unexpected stderr. This function complementsassert_stderr
and supports matching via literal, partial, or regular expression. Update documentation to reflect this addition and clarify usage ofassert_stderr
with--separate-stderr
for proper stderr handling.Add a new assert_stderr_line function for checking expected lines in the stderr output. This improves the clarity and functionality of the assertion process.
Refactor the
refute_line
function to handle both output and stderr streams uniformly. Introduce a new helper function__refute_stream_line
to streamline the logic and reduce code duplication.Introduce the
refute_stderr_line
function to verify that an unexpected line does not appear in the stderr output. Update documentation to reflect usage and necessary conditions for correct operation, including the requirement to use--separate-stderr
when running commands.