Re: Be very careful in assumptions in tests

2015-12-04 Thread William Reade
Indeed, and to expand on all that: test-first or test-last, it's smart to purposely break your code and make sure that your test *fails* semi-cleanly (rather than, e.g., deadlocking). On Fri, Dec 4, 2015 at 3:32 AM, Nate Finch wrote: > I'll definitely +1 the need for gc.HasLen ... I've seen a to

Re: Be very careful in assumptions in tests

2015-12-03 Thread Nate Finch
I'll definitely +1 the need for gc.HasLen ... I've seen a ton of panics in tests if the code starts erroneously returning nil slices. Obviously this is less bad, since the tests still fail, but they're really ugly annoying failures. And +1000 to making tests that fail before fixing the code (or a

Be very careful in assumptions in tests

2015-12-03 Thread Tim Penhey
Hi folks, I came across an interesting bug yesterday and during investigation found that there was a very comprehensive test that covered the situation. The problem is that the asserts were not actually running. The asserts were inside a loop where the expectation was that the loop would run exa