I have many tests that need to check that the return value *really is* false without passing 0 or empty string. I'm sick of using
It works but is less elegant than
I admit up front that it may open people up to "false passes" when they forget and use assertFalse(), but you can do that already. If you accidentally use this new API when you mean assertFalse(), the worst that can happen is a "false fail" which you can easily fix.
The other option is to make assertTrue/False() use ===. This is what I would normally expect and had to dig to find out why my test was passing when it should have failed (was returning 0 for getIndex() but was expecting false for not found).
Log in to post a comment.