Dlang tour - Unittesting example
Steven Schveighoffer
schveiguy at gmail.com
Tue Oct 2 22:31:55 UTC 2018
On 10/2/18 8:30 AM, Joe wrote:
> On Tuesday, 2 October 2018 at 12:25:19 UTC, Joe wrote:
>> On Tuesday, 2 October 2018 at 09:59:28 UTC, bauss wrote:
>>> On Tuesday, 2 October 2018 at 04:13:01 UTC, Joe wrote:
>>>> There appears to be a problem with the example at
>>>>
>>>> https://tour.dlang.org/tour/en/gems/unittesting
>>>>
>>>> If compiled with -unittest, the resulting program crashes. It
>>>> happens with ldc2 on Linux but it can also be seen if you click on
>>>> "Export" and run it with dmd -unittest.
>>>
>>> I think it's more likely a problem with your OS.
>>>
>>> I am unable to reproduce that with either of dmd or ldc.
>>
>> Well then it's also a problem with run.dlang.io, since as I said it
>> also happens when you run it there.
>
> I forgot to mention: at the end, it reports "1/1 unittests FAILED". I
> see three tests--two in the struct and the separate one--but the
> assertion failure is in line 49 (the standalone) so apparently the other
> two are not being run (or reported).
I will note that the granularity of the unittests is based on how many
*modules* were tested. There is only one unittest function in each
ModuleInfo (as provided by the compiler to the runtime), so that's the
number that's being reported. So in this case, it's not missing
unittests, it's running all given unit tests.
-Steve
More information about the Digitalmars-d-learn
mailing list