February 18, 2020
I have a function add(index, data) which throws RangeError if the index is invalid.

unittest { // is supposed to test that RangeError is thrown on a range violation
   assertThrown!RangeError(add(size_t.max, something)); //which doesn't work, the test is killed with core.exception.RangeError: Range violation

   // this kills the test, too: core.exception.RangeError: Range violation
   try {
     add(size_t.max, something);
     assert(false, "Expecting RangeError");
   } catch (RangeError) {}
}

Just for clarification, I do _not_ intend to catch RangeError outside of a unittest. What I want is that the test acknowledges the correctly thrown RangeError and gracefully reports success.


What are my options?
February 18, 2020
On Tuesday, 18 February 2020 at 13:07:35 UTC, wjoe wrote:
> I have a function add(index, data) which throws RangeError if the index is invalid.
>

Never mind. For whatever reason RangeError is now caught. Sorry for the noise.