mustExcept

bool
mustExcept
(
E = Exception
)
(
void delegate(
)
fnc
,
bool throwUnexpected = false
)
if (
is(E : Throwable)
)
in { assert (fnc); }

Examples

assert( mustExcept!Exception( { throw new Exception("test"); } ) );
assert( !mustExcept!Exception( { throw new Throwable("test"); } ) );
assert( !mustExcept!Exception( { auto a = 4; } ) );

Meta