This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
bump version to 5.16.0 RC0
[perl5.git] / cpan / Test / t / todo.t
CommitLineData
809908f7
MS
1# -*-perl-*-
2use strict;
711cdd39 3use Test qw(:DEFAULT $TESTOUT $TESTERR $ntest);
809908f7 4
edd5bad5
MS
5### This test is crafted in such a way as to prevent Test::Harness from
6### seeing the todo tests, otherwise you get people sending in bug reports
7### about Test.pm having "UNEXPECTEDLY SUCCEEDED" tests.
8
9open F, ">todo";
10$TESTOUT = *F{IO};
711cdd39 11$TESTERR = *F{IO};
edd5bad5
MS
12my $tests = 5;
13plan tests => $tests, todo => [2..$tests];
14
75fa620a
SB
15
16# tests to go to the output file
edd5bad5 17ok(1);
809908f7
MS
18ok(1);
19ok(0,1);
20ok(0,1,"need more tuits");
21ok(1,1);
edd5bad5
MS
22
23close F;
24$TESTOUT = *STDOUT{IO};
711cdd39 25$TESTERR = *STDERR{IO};
edd5bad5
MS
26$ntest = 1;
27
28open F, "todo";
29my $out = join '', <F>;
30close F;
31unlink "todo";
32
33my $expect = <<"EXPECT";
341..5 todo 2 3 4 5;
35ok 1
75fa620a 36ok 2 # ($0 at line 18 TODO?!)
edd5bad5 37not ok 3
75fa620a 38# Test 3 got: '0' ($0 at line 19 *TODO*)
edd5bad5
MS
39# Expected: '1'
40not ok 4
75fa620a 41# Test 4 got: '0' ($0 at line 20 *TODO*)
edd5bad5 42# Expected: '1' (need more tuits)
75fa620a 43ok 5 # ($0 at line 21 TODO?!)
edd5bad5
MS
44EXPECT
45
46
75fa620a
SB
47sub commentless {
48 my $in = $_[0];
49 $in =~ s/^#[^\n]*\n//mg;
50 $in =~ s/\n#[^\n]*$//mg;
51 return $in;
52}
53
edd5bad5 54print "1..1\n";
75fa620a 55ok( commentless($out), commentless($expect) );