1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#!/usr/bin/env perl
#
# show_exceptions.t
#
########################################################################
#
package Testcase::Spec::ShowExceptions;
use Test::Spec;
use FindBin qw($Bin);
BEGIN { require "$Bin/test_helper.pl" };
describe "Test::Spec" => sub {
my $tap = capture_tap("dying_spec.pl");
it "should explain why a dying test failed" => sub {
like($tap, qr/^# Failed test 'Test::Spec should trap die message' by dying:\s*$/m);
};
it "should echo the exception message" => sub {
like($tap, qr/^# this should be displayed\s*$/m);
};
it "should report the context at which the error occurred" => sub {
like($tap, qr/^# at .+? line \d+\.\s*$/m);
};
it "should continue running tests after an exception is encountered" => sub {
like($tap, qr/^ok \d+ - Test::Spec should continue testing/m);
};
it "should report usage errors from the location of the error" => sub {
my ($utap) = split /[\r\n]+/, capture_tap("uncompilable_spec.pl");
like($utap, qr/at .*uncompilable_spec.pl line \d+/);
};
};
runtests unless caller;
|