-
Notifications
You must be signed in to change notification settings - Fork 22
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
Assertion with contains
and empty $output produces automatic pass
#84
Comments
I suspect that the only proper way to fix this is to change the way |
If it comes to it we can do that, but I'd rather keep it readable. The double quotes should prevent that from happening, so I'm inclined to think it's a bug |
Nothing stands out as obvious from the source code 🤔 there are clearly quite a few things I need to learn about shell scripts |
Internally, the `assert` helper does not quote the value to be asserted against when cascading the call to the relevant assertion function, resulting in an implicit pass if the value is empty, since the comparisons are shifted forward a step. Double quoting the vaue when cascading prevents these false-positives from occurring. - [ ] Write tests to capture these false-positives Fix #84
Internally, the `assert` helper does not quote the value to be asserted against when cascading the call to the relevant assertion function, resulting in an implicit pass if the value is empty, since the comparisons are shifted forward a step. Double quoting the vaue when cascading prevents these false-positives from occurring. - [ ] Write tests to capture these false-positives Fix #84
@molovo any chance we could get the relevant PR merged for this? I'm still affected by this bug right now :( |
@MichaelAquilina whoops, thought I'd already merged it. I'll tag a new release tonight |
Internally, the `assert` helper does not quote the value to be asserted against when cascading the call to the relevant assertion function, resulting in an implicit pass if the value is empty, since the comparisons are shifted forward a step. Double quoting the vaue when cascading prevents these false-positives from occurring. - [ ] Write tests to capture these false-positives Fix #84
Simplest way to explain this is with a test example:
This also works with any other empty variable being tested - but output is usually the most likely case.
This is likely to do with the way assert has been written so that the assert operator is after the first operand. So zunit treats the the assert as
assert contains "hello"
since "$output" is empty.The text was updated successfully, but these errors were encountered: