xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/Test/t/skip.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate# -*-perl-*-
2*0Sstevel@tonic-gateuse strict;
3*0Sstevel@tonic-gateuse Test qw($TESTOUT $TESTERR $ntest plan ok skip);
4*0Sstevel@tonic-gateplan tests => 6;
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gateopen F, ">skips" or die "open skips: $!";
7*0Sstevel@tonic-gate$TESTOUT = *F{IO};
8*0Sstevel@tonic-gate$TESTERR = *F{IO};
9*0Sstevel@tonic-gate
10*0Sstevel@tonic-gateskip(1, 0);  #should skip
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gatemy $skipped=1;
13*0Sstevel@tonic-gateskip('hop', sub { $skipped = 0 });
14*0Sstevel@tonic-gateskip(sub {'jump'}, sub { $skipped = 0 });
15*0Sstevel@tonic-gateskip('skipping stones is more fun', sub { $skipped = 0 });
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateclose F;
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gate$TESTOUT = *STDOUT{IO};
20*0Sstevel@tonic-gate$TESTERR = *STDERR{IO};
21*0Sstevel@tonic-gate$ntest = 1;
22*0Sstevel@tonic-gateopen F, "skips" or die "open skips: $!";
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gateok $skipped, 1, 'not skipped?';
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gatemy @T = <F>;
27*0Sstevel@tonic-gatechop @T;
28*0Sstevel@tonic-gatemy @expect = split /\n+/, join('',<DATA>);
29*0Sstevel@tonic-gateok @T, 4;
30*0Sstevel@tonic-gatefor (my $x=0; $x < @T; $x++) {
31*0Sstevel@tonic-gate    ok $T[$x], $expect[$x];
32*0Sstevel@tonic-gate}
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gateEND { close F; unlink "skips" }
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gate__DATA__
37*0Sstevel@tonic-gateok 1 # skip
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gateok 2 # skip hop
40*0Sstevel@tonic-gate
41*0Sstevel@tonic-gateok 3 # skip jump
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gateok 4 # skip skipping stones is more fun
44