File: filter_fixtures_only.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 (32 lines) | stat: -rw-r--r-- 896 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
28
29
30
31
32
use strict;
use warnings;
use Test::More tests => 1;

{   package Foo;
    use Test::More;
    use base qw(Test::Class);

    sub test_filtered_startup : Test( startup => 1 ) {
        fail( "startup test not run, as no normal tests are unfiltered" );
    }

    sub test_filtered_setup : Test( setup => 1 ) {
        fail( "setup test not run, as no normal tests are unfiltered" );
    }

    sub test_filtered_teardown : Test( teardown => 1 ) {
        fail( "teardown test not run, as no normal tests are unfiltered" );
    }

    sub test_filtered_shutdown : Test( shutdown => 1 ) {
        fail( "shutdown test not run, as no normal tests are unfiltered" );
    }

    sub test_filtered : Test( 1 ) {
        fail( "shouldn't run, due to matching filter" );
    }
}

Test::Class->add_filter( sub { 0 } );

is( Test::Class->expected_tests, 0, 'setup/teardown not run when no test methods' );