Re: length's type.

2024-02-16 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 13 February 2024 at 23:57:12 UTC, Ivan Kazmenko wrote: I do use lengths in arithmetic sometimes, and that leads to silent bugs currently. On the other hand, since going from 16 bits to 32 and then 64, in my user-side programs, I had a flat zero bugs because some length was 2^{31}

Re: length's type.

2024-02-16 Thread Kagamin via Digitalmars-d-learn
On Thursday, 8 February 2024 at 05:56:57 UTC, Kevin Bailey wrote: How many times does the following loop print? I ran into this twice doing the AoC exercises. It would be nice if it Just Worked. ``` import std.stdio; int main() { char[] something = ['a', 'b', 'c']; for (auto i = -1; i <

Re: Are exceptions caught in unittests?

2024-02-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 16 February 2024 at 08:48:08 UTC, Jonathan M Davis wrote: On Friday, February 16, 2024 1:06:26 AM MST Ferhat Kurtulmuş via Digitalmars- d-learn wrote: [...] 1. assertThrown does not test whether something somewhere in what you called threw an exception. It asserts that it catches

Re: Are exceptions caught in unittests?

2024-02-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, February 16, 2024 1:06:26 AM MST Ferhat Kurtulmuş via Digitalmars- d-learn wrote: > On Friday, 16 February 2024 at 07:43:24 UTC, Ferhat Kurtulmuş > > wrote: > > When I tried to catch exceptions in my unit test, I found that > > exceptions were not thrown or caught in the unit test

Re: Are exceptions caught in unittests?

2024-02-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 16 February 2024 at 07:43:24 UTC, Ferhat Kurtulmuş wrote: When I tried to catch exceptions in my unit test, I found that exceptions were not thrown or caught in the unit test blocks. So, I cannot use assertThrown at all. Is this a bug or expected behavior that I don't know? Using

Re: Are exceptions caught in unittests?

2024-02-16 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 16 February 2024 at 07:54:01 UTC, Richard (Rikki) Andrew Cattermole wrote: This should be working. I don't know what is going on. All I can suggest is to use a debugger to see if it is indeed throwing and then catching. A test code like this works, but unittest doesn't. This is