Unit tests, asserts and contradictions in the spec

Atila Neves atila.neves at gmail.com
Fri Feb 8 09:02:02 UTC 2019


On Thursday, 7 February 2019 at 18:53:22 UTC, H. S. Teoh wrote:
> On Thu, Feb 07, 2019 at 06:10:58PM +0000, jmh530 via 
> Digitalmars-d wrote:
>> On Thursday, 7 February 2019 at 15:43:34 UTC, H. S. Teoh wrote:
>> > [snip]
>> > Of course, on the flip side, unittests that acquire global /
>> > external resources that need cleanup, etc., are IMNSHO a 
>> > code smell.
>> 
>> That's a good point. I should probably just stick pure on 
>> every unittest block by default.
>
> That's a good ideal to strive for, but then it would preclude 
> testing non-pure functions, which seems rather too limiting to 
> me.
>
>
> T

When my functions aren't pure I get sad.

Unfortunately sometimes there's nothing I can do about it because 
I depend on external code that isn't pure itself. But my default 
for unit tests is `@safe pure`.


More information about the Digitalmars-d mailing list