DUnit: Advanced unit testing toolkit.

Gary Willoughby dev at nomad.so
Sun Sep 22 10:36:32 PDT 2013


On Sunday, 22 September 2013 at 15:54:39 UTC, Gary Willoughby 
wrote:
> The reason i've gone with just providing more specific assert 
> methods is that i can create nice helpful error message when 
> things go wrong. For example this line:
>
>     1.assertEquals(0);
>
> Creates this error:
>
>     
> +------------------------------------------------------------
>     | Failed asserting equal
>     
> +------------------------------------------------------------
>     | File: example.d
>     | Line: 85
>     
> +------------------------------------------------------------
>     | ✓ Expected int: 1
>     | ✗ Actual int: 2
>
> Making debugging what went wrong loads easier. These messages 
> give you so much useful info that you will never go back to 
> only using assert() again.

Actually that should read:

     +------------------------------------------------------------
     | Failed asserting equal
     +------------------------------------------------------------
     | File: example.d
     | Line: 85
     +------------------------------------------------------------
     | ✓ Expected int: 0
     | ✗ Actual int: 1

But you get the idea. ;)


More information about the Digitalmars-d-announce mailing list