blob: 2f80e578844dc1b08a892d81d17eb03c09e7f181 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/perl -w
use strict;
use lib 't/lib';
use Test::More tests => 5;
use File::Spec;
use Test::Harness;
{
#todo_skip 'Harness compatibility incomplete', 5;
#local $TODO = 'Harness compatibility incomplete';
my $died;
sub prepare_for_death {
$died = 0;
return sub { $died = 1 }
}
my $curdir = File::Spec->curdir;
my $sample_tests = File::Spec->catdir( $curdir, 't', 'sample-tests' );
{
local $SIG{__DIE__} = prepare_for_death();
eval { _runtests( File::Spec->catfile( $sample_tests, "simple" ) ); };
ok( !$@, "simple lives" );
is( $died, 0, "Death never happened" );
}
{
local $SIG{__DIE__} = prepare_for_death();
eval {
_runtests( File::Spec->catfile( $sample_tests, "too_many" ) );
};
ok( $@, "error OK" );
ok( $@ =~ m[Failed 1/1], "too_many dies" );
is( $died, 1, "Death happened" );
}
}
sub _runtests {
my (@tests) = @_;
local $ENV{PERL_TEST_HARNESS_DUMP_TAP} = 0;
local $ENV{HARNESS_VERBOSE} = 0;
local $ENV{HARNESS_DEBUG} = 0;
local $ENV{HARNESS_TIMER} = 0;
local $Test::Harness::Verbose = -9;
runtests(@tests);
}
# vim:ts=4:sw=4:et:sta
|