Testing for Exceptions

This lesson explains how to test some code for exception types.

We'll cover the following...

std.exception module #

It is common to test some code for exception types that it should or should not throw under certain conditions. The std.exception module contains two functions that help with testing for exceptions:

  • assertThrown: ensures that a specific exception type is thrown from ...