Unit Testing in Action

Mario Kröplin linkrope at github.com
Sat Oct 21 21:23:44 UTC 2017


On Friday, 20 October 2017 at 21:26:35 UTC, qznc wrote:
> * fluent-asserts is considered the best expectations library. 
> Syntax is `(x + y).should.equal(42).because("of test 
> reasons");` and it gives nice output with code snippets.

The code snippets were the prominent feature from the 
announcement of fluent-asserts. But this feature was the reason 
why I originally dismissed the library. In my opinion, the goal 
is that the failure message describes the issue without the need 
to look at the test implementation.

The diff of lengthy strings is, what I was always looking for. 
Back then, I wrote a lightweight kind of diff for dunit. In 
writing the blog post, I rechecked code.dlang.org. To my 
surprise, Sönke Ludwig ported google-diff-match-patch to D in 
2014. (The status is "build: error", but there is hope that it's 
only corner cases that don't work.) Further investigation 
revealed that fluent-asserts uses this port. So, it's this 
"hidden feature" that currently makes fluent-asserts my favorite.


More information about the Digitalmars-d-announce mailing list