File: skip_class_reason.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 (54 lines) | stat: -rwxr-xr-x 1,011 bytes parent folder | download | duplicates (5)
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
#! /usr/bin/perl -T

use strict;
use warnings;
use Test::Class;
use Test;
use Fcntl;
use IO::File;
use Test::Builder;

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

    sub skipped_with_reason : Test( 3 )  { fail( "this should not run" ) };
    __PACKAGE__->SKIP_CLASS( 'because SKIP_CLASS returned a string' );
}

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

    sub skipped_with_reason : Test( 3 )  { fail( "this should not run" ) };
    __PACKAGE__->SKIP_CLASS( 1 );
}

plan tests => 3;

my $io = IO::File->new_tmpfile or die "couldn't create tmp file ($!)\n";
my $Test = Test::Builder->new;				
$Test->output($io);
$Test->failure_output($io);

$ENV{TEST_VERBOSE}=0;

Test::Class->runtests;

END {
	seek $io, SEEK_SET, 0;
	while (my $actual = <$io>) {
		chomp($actual);
		my $expected=<DATA>; chomp($expected);
		ok($actual, $expected);
	};

	ok($?, 0, "exit value okay");
	$?=0;
};

__DATA__
1..1
ok 1 # skip because SKIP_CLASS returned a string