File: run_all_tests.t

package info (click to toggle)
libtest-class-perl 0.35-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 476 kB
  • ctags: 102
  • sloc: perl: 1,668; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 791 bytes parent folder | download | duplicates (7)
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
#! /usr/bin/perl -T

use strict;
use warnings;
use Test::Class;

my @CALLED = ();

{
    package Base::Test;
    use base qw(Test::Class);
    Base::Test->SKIP_CLASS( 1 );
    sub setup : Test { die "this should not run" }
}

{
    package A::Test;
    use base qw(Base::Test);
    use Test::More;
    sub setup : Test {
        pass 'non skipping test class run as expected';
        push @CALLED, 'A::Test'
    }
}

package main;
use Test::More tests => 5;

ok(! Test::Class->SKIP_CLASS,   'Test::Class->SKIP_CLASS default' );
ok(  Base::Test->SKIP_CLASS,    'Base::Test->SKIP_CLASS overridden' );
ok(! A::Test->SKIP_CLASS,       'A::Test->SKIP_CLASS default' );

Base::Test->runtests;
is_deeply(
    [sort @CALLED], [ qw(A::Test) ], 
    'runtests skipped classes with SKIP_CLASS set'
);