On Saturday, 5 May 2018 at 15:51:11 UTC, Johannes Loher wrote:
On Saturday, 5 May 2018 at 13:28:41 UTC, Atila Neves wrote:
For those not in the know, unit-threaded is an advanced
testing library for D that runs tests in threads by default.
It has a lot of features:
http://code.dlang.org/packages/unit-threaded
New:
* Bug fixes
* Better integration testing
* unitThreadedLight mode also runs tests in threads
* More DDoc documentation (peer pressure from Adam's site)
* Sorta kinda fluent-like asserts
On the new asserts (should and should.be are interchangeable):
1.should == 1
1.should.not == 2
1.should.be in [1, 2, 3]
4.should.not.be in [1, 2, 3]
More controversially (due to a lack of available operators to
overload):
// same as .shouldApproxEqual
1.0.should ~ 1.0001;
1.0.should.not ~ 2.0;
// same as .shouldBeSameSetAs
[1, 2, 3].should ~ [3, 2, 1];
[1, 2, 3].should.not ~ [1, 2, 2];
I also considered adding `.should ~=`. I think it even reads
better, but apparently some people don't. Let me know?
The operator overloads are completely optional.
Atila
Personally, I don't like that kind of "abuse" of operators at
all. I think it looks really unusual and it kind of breaks your
"flow" when reading the code.
I agree with this. If the comments weren't added, nobody reading
the code would have any idea what it actually does except for
whoever wrote it.