-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
chore: add fail() function #249
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How interesting. Is this something you have seen in other libraries, @ceejatec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution and for treating bashunit with the same care as we do, I love your idea.
docs/assertions.md
Outdated
function test_failure() { | ||
[ $(date +%-H) -lt 6 ] || fail "It's late, go to bed" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example you set for test_failure doesn't always fail because it depends on the time of execution. The idea is to have one of the examples always succeed and the other always fail. Could you change it?
I think it would also help to use the if syntax instead of the || operator in both examples, as it's more familiar to a greater number of programmers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified them as requested. I had trouble coming up with an example that could seem useful in only a line or two, but I think this gets the job done.
@Chemaclass Indeed, it's a pretty common function, going right back to JUnit. IME, frequently the various assert() methods are internally implemented in terms of the basic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
📚 Description
Adds new
fail()
function for general purpose test failures not covered by the variousassert_*
functions.🔖 Changes
fail()
function in assert.shconsole_results::print_failure_message()
function in console_results.sh✅ To-do list
CHANGELOG.md
to reflect the new feature or fix