sub dies-ok

Documentation for sub dies-ok assembled from the following types:

module Test

From Test

(Test) sub dies-ok

Defined as:

multi sub dies-ok(Callable $code, $reason = '')

Marks a test as passed if the given $code throws an exception.

The function accepts an optional description of the test.

sub saruman(Bool :$ents-destroy-isengard) {
    die "Killed by Wormtongue" if $ents-destroy-isengard;
}

dies-ok { saruman(ents-destroy-isengard => True) }, "Saruman dies";