Unittest Absurdity

Ruby The Roobster rubytheroobster at yandex.com
Fri Aug 5 01:51:21 UTC 2022


On Friday, 5 August 2022 at 01:47:07 UTC, Ruby The Roobster wrote:
> On Friday, 5 August 2022 at 01:42:23 UTC, jfondren wrote:
>> On Friday, 5 August 2022 at 01:38:48 UTC, jfondren wrote:
>>
>> Here's a complete example that passes tests:
>>
>> ```d
>> struct S {
>>     int n;
>>     void opOpAssign(string op)(S rhs) if (op == "/") {
>>         n++;
>>     }
>> }
>>
>> unittest {
>>     auto a = S(1), b = S(2);
>>     a /= b;
>>     b /= a;
>>     assert(a.n == 2);
>>     assert(b.n == 3);
>> }
>> ```
>
> I found the issue:  opOpAssign isn't getting called at all.  I 
> have no idea why, though.

Even then, I still have a bug, but that is completely unrelated 
to this issue.


More information about the Digitalmars-d-learn mailing list