summaryrefslogtreecommitdiff
path: root/lib/Test
diff options
context:
space:
mode:
authorSean M. Burke <sburke@cpan.org>2002-08-25 22:38:19 -0600
committerhv <hv@crypt.org>2002-08-26 15:34:25 +0000
commit75fa620ac02fb8930e654aff3c635036e78e564a (patch)
tree0ff0686b9a78ae38ee22e838219d778ed3f603fa /lib/Test
parentaa6930702d30b377634933794b8700d63528659d (diff)
downloadperl-75fa620ac02fb8930e654aff3c635036e78e564a.tar.gz
CPAN Upload: S/SB/SBURKE/Test-1.21.tar.gz
From: "Sean M. Burke" <sburke@cpan.org> Message-Id: <5.1.0.14.1.20020826043702.022ca320@mail.spinn.net> p4raw-id: //depot/perl@17786
Diffstat (limited to 'lib/Test')
-rw-r--r--lib/Test/t/fail.t11
-rw-r--r--lib/Test/t/mix.t10
-rw-r--r--lib/Test/t/todo.t21
3 files changed, 33 insertions, 9 deletions
diff --git a/lib/Test/t/fail.t b/lib/Test/t/fail.t
index ce37464d04..9051a1f481 100644
--- a/lib/Test/t/fail.t
+++ b/lib/Test/t/fail.t
@@ -51,8 +51,17 @@ shift @got;
$Expect =~ s/\n+$//;
my @expect = split /\n\n/, $Expect;
+
+sub commentless {
+ my $in = $_[0];
+ $in =~ s/^#[^\n]*\n//mg;
+ $in =~ s/\n#[^\n]*$//mg;
+ return $in;
+}
+
+
for (my $x=0; $x < @got; $x++) {
- ok $got[$x], $expect[$x]."\n";
+ ok commentless($got[$x]), commentless($expect[$x]."\n");
}
diff --git a/lib/Test/t/mix.t b/lib/Test/t/mix.t
index a746ba66b5..5298338318 100644
--- a/lib/Test/t/mix.t
+++ b/lib/Test/t/mix.t
@@ -46,5 +46,13 @@ ok 4 # skip
EXPECT
+sub commentless {
+ my $in = $_[0];
+ $in =~ s/^#[^\n]*\n//mg;
+ $in =~ s/\n#[^\n]*$//mg;
+ return $in;
+}
+
+
print "1..1\n";
-ok( $out, $expect );
+ok( commentless($out), commentless($expect) );
diff --git a/lib/Test/t/todo.t b/lib/Test/t/todo.t
index 2f179e4547..74f9aefb8b 100644
--- a/lib/Test/t/todo.t
+++ b/lib/Test/t/todo.t
@@ -9,11 +9,11 @@ use Test qw(:DEFAULT $TESTOUT $TESTERR $ntest);
open F, ">todo";
$TESTOUT = *F{IO};
$TESTERR = *F{IO};
-
my $tests = 5;
plan tests => $tests, todo => [2..$tests];
-# line 11
+
+# tests to go to the output file
ok(1);
ok(1);
ok(0,1);
@@ -33,16 +33,23 @@ unlink "todo";
my $expect = <<"EXPECT";
1..5 todo 2 3 4 5;
ok 1
-ok 2 # ($0 at line 12 TODO?!)
+ok 2 # ($0 at line 18 TODO?!)
not ok 3
-# Test 3 got: '0' ($0 at line 13 *TODO*)
+# Test 3 got: '0' ($0 at line 19 *TODO*)
# Expected: '1'
not ok 4
-# Test 4 got: '0' ($0 at line 14 *TODO*)
+# Test 4 got: '0' ($0 at line 20 *TODO*)
# Expected: '1' (need more tuits)
-ok 5 # ($0 at line 15 TODO?!)
+ok 5 # ($0 at line 21 TODO?!)
EXPECT
+sub commentless {
+ my $in = $_[0];
+ $in =~ s/^#[^\n]*\n//mg;
+ $in =~ s/\n#[^\n]*$//mg;
+ return $in;
+}
+
print "1..1\n";
-ok( $out, $expect );
+ok( commentless($out), commentless($expect) );