Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
assert_contains function #10
Here's the assert_contains() function I wrote for regex matching.
Usage is: assert_contains "str" "regex" [0|1], where 0=expected match, 1=nomatch
First of all, great project Robert, I was very happy to come across this.
Regarding this issue though, just an outsider's take on this is I think the trade off is where do you want the complexity - either in the tests written to use this framework, or in the underlying framework implementation.
I understand the desire to keep the assert API simple, but the fact I went searching for this functionality is probably an indication that
The downside with keeping it too simple is that people like me who will tire of writing:
too many times instead of:
will have to write their own
On one hand this is probably exactly what should happen, everyone can write their own scripts separate to
As a follow-up I've created a Pull Request (#13) contributing this functionality as suggested above (in new optional assert-extras.sh).
Alternatively it is available in my fork: https://github.com/dansoton/assert.sh/tree/assert-extras