Checksum / critic.sh

Dead simple testing framework for Bash with coverage reporting
MIT License
455 stars 11 forks source link

_assert _ouput_contains does not work if optional message is specified #4

Closed johngassman-ws closed 4 years ago

johngassman-ws commented 4 years ago

_output_contains is grep'ing for all following args ("$*") which breaks if you specify an optional message

Example: Given a method that just: echo "Gimme some foo"

Happy path: _assert _output_contains "foo"

Unhappy path: _assert _output_contains "foo" "there is foo"

Changing the _output_contains function to: grep -Fqi "$1" <<< "$_output" appears to fix the issue.

Checksum commented 4 years ago

Thanks for the bug report! Should be a straightforward fix like you pointed out. Will get it in ASAP.