There must be module with test assertions in Phobos

max haughton maxhaton at gmail.com
Tue Apr 4 15:45:55 UTC 2023


On Tuesday, 4 April 2023 at 12:11:28 UTC, Quirin Schroll wrote:
> On Thursday, 30 March 2023 at 17:01:26 UTC, Dmytro Katyukha 
> wrote:
>> [...]
>
> I’d say most are superfluous:
> - `assertEqual(a, b)` why not use `assert(a == b)`?
> - `assertNotEqual(a, b)` why not use `assert(a != b)`?
> - `assertTrue(cond)` why not use `assert(cond)`?
> - `assertFalse(cond)` why not use `assert(!cond)`?
> - `assertGreater` why not use `assert(a > b)`?
> - `assertGreaterEqual` why not use `assert(a >= b)`?
> - `assertLessEqual` why not use `assert(a <= b)`?
>
> [...]

They are redundant but they allow some slightly nicer failure 
messages upon failure (i.e. assert fail is not very helpful 
unless you are at one with all the code)

It may be of note that Atila has implemented most (all?) of this 
in unit_threaded.


More information about the Digitalmars-d mailing list