summaryrefslogtreecommitdiff
path: root/lib/Test/t/skip.t
blob: 7db35e65dc8414b45586232518c21708990ef458 (plain)
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
# -*-perl-*-
use strict;
use Test qw($TESTOUT $ntest plan ok skip); plan tests => 6;

open F, ">skips" or die "open skips: $!";
$TESTOUT = *F{IO};

skip(1, 0);  #should skip

my $skipped=1;
skip('hop', sub { $skipped = 0 });
skip(sub {'jump'}, sub { $skipped = 0 });
skip('skipping stones is more fun', sub { $skipped = 0 });

close F;

$TESTOUT = *STDOUT{IO};
$ntest = 1;
open F, "skips" or die "open skips: $!";

ok $skipped, 1, 'not skipped?';

my @T = <F>;
chop @T;
my @expect = split /\n+/, join('',<DATA>);
ok @T, 4;
for (my $x=0; $x < @T; $x++) {
    ok $T[$x], $expect[$x];
}

END { close F; unlink "skips" }

__DATA__
ok 1 # skip

ok 2 # skip hop

ok 3 # skip jump

ok 4 # skip skipping stones is more fun