Similar to Test::Warn there is also a module called Test::Exception
to test for calls to die.
Try calling fibonacci(); and writing a test for it.
use strict;
use warnings;
use Test::More tests => 3;
use lib 'lib';
use MyTools;
{
my $result = fibonacci(3);
is($result, 2, 'fibonacci on 3');
}
{
my $result = fibonacci();
is($result, 1, 'fibonacci()');
}
{
my $result = fibonacci(4);
is($result, 3, 'fibonacci on 4');
}
1..3
ok 1 - fibonacci on 3
Need to get a number
# Looks like you planned 3 tests but only ran 1.
# Looks like your test died just after 1.