-
-
Notifications
You must be signed in to change notification settings - Fork 41
Add assert_true and assert_false #350
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
Conversation
skinner-m-c
left a comment
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.
Thanks for adding true and false assertions.
| local actual="$1" | ||
|
|
||
| if [[ "$actual" != "false" && "$actual" != "1" ]]; then | ||
| local label |
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.
[nit] Note that this does not seem to work on functions. If I pass assert_true ls the assertion fails. A potential problem may be that the concept of true and false as used in if statements does not apply with this assertion. If statements really just match the exit code of the expression. Bash makes use of the test program to perform much of the boolean logic in BASH, which has the [[ ... ]] shorthand.
Future work might want to test if the value passed is a function (type -f <var>) or a value and do something. different.
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 will work on this, many thanks!! | UPDATE: #352
π Changes
assert_trueassert_falseβ To-do list
CHANGELOG.mdto reflect the new feature or fix