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 -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);
next if $actual =~ /^TAP version \d+/;
$actual =~ s{# skip\b}{# skip}i; # normalize directives
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
|