Skip to content

Conversation

@Chemaclass
Copy link
Member

@Chemaclass Chemaclass commented Oct 4, 2024

πŸ”– Changes

  • Add assert_true
  • Add assert_false

βœ… To-do list

  • I updated the CHANGELOG.md to reflect the new feature or fix
  • I updated the documentation to reflect the changes
Screenshot 2024-10-04 at 22 26 30

@Chemaclass Chemaclass added the enhancement New feature or request label Oct 4, 2024
@Chemaclass Chemaclass self-assigned this Oct 4, 2024
@Chemaclass Chemaclass changed the title Assert true Add assert_true and assert_false Oct 4, 2024
@Chemaclass Chemaclass merged commit 5c51916 into main Oct 5, 2024
@Chemaclass Chemaclass deleted the feat/assert-true branch October 5, 2024 17:47
Copy link
Contributor

@skinner-m-c skinner-m-c left a 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
Copy link
Contributor

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.

Copy link
Member Author

@Chemaclass Chemaclass Oct 5, 2024

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

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

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants