Help for this page

Select Code to Download


  1. or download this
    die "reason";
    # versus just
    die;
    
  2. or download this
    {
       package Maths;
    ...
    my @expected = qw/ 0 1 2 6 24 100 720 /;
    plan tests => scalar @expected;
    is(Maths::factorial($_), $expected[$_], "Factorial of $_") for 0 .. $#
    +expected;
    
  3. or download this
    {
        package Maths;
    ...
    dies_ok { Maths::factorial(-2) } "Factorial of negative number";
    
    done_testing;