File: die-in-setup.t

package info (click to toggle)
libtest-class-perl 0.52-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 540 kB
  • sloc: perl: 1,706; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 687 bytes parent folder | download
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
use strict;
use warnings;

{
    package Foo;
    use base qw( Test::Class );
    use Test::More;
    
    sub setup_method :Test(setup) {
        die "oops - we died\n";
    }
    
    sub test : Test {
        pass "this should never run";
    }
}

use Test::Builder::Tester tests => 1;
$ENV{TEST_VERBOSE}=0;
test_out( "not ok 1 - setup_method (for test method 'test') died (oops - we died)" );
test_err( "#   Failed test 'setup_method (for test method 'test') died (oops - we died)'" );
test_err( "#   at $0 line 25." );
test_err( "#   (in Foo->setup_method)" );
test_out("ok 2 # skip setup_method died");
Test::Class->runtests;
test_test("die in setup caused test method to fail");