by Deradon · 7y ago · 0 comments
I've done this in the past. Then I started to use `git bisect` and having a red test somewhere in your commit-history is a killer for bisect. So now I tend to include both, the test and the bug-fix, within one commit.
That way you can commit the test, bisect works, and the test begins "failing" when the bug is really fixed, and you can commit the fix as well as a one-line change to amend the test from being failure-expected to just a normal test.
Obviously if you view tests differently (eg. as a declaration of current behavior rather than intended behavior) then my argument dies.
@failing testDivZero() { assertEquals(None, div(1, 0)) }
This expresses both the intent and the reality