Re: How to catch RangeError in unittest?

2020-02-18 Thread wjoe via Digitalmars-d-learn
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.

How to catch RangeError in unittest?

2020-02-18 Thread wjoe via Digitalmars-d-learn
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: