From: Nicholas Clark Date: Fri, 9 Oct 2009 12:06:07 +0000 (+0200) Subject: Don't use require in comp/retainedlines.t, as require isn't tested yet. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1909e25bea0b772d68da5ef64e05c3f088e2f4b4;p=p5sagit%2Fp5-mst-13.2.git Don't use require in comp/retainedlines.t, as require isn't tested yet. Emit TAP directly. --- diff --git a/t/comp/retainedlines.t b/t/comp/retainedlines.t index da7866f..8de8237 100644 --- a/t/comp/retainedlines.t +++ b/t/comp/retainedlines.t @@ -2,13 +2,45 @@ # Check that lines from eval are correctly retained by the debugger -require "./test.pl"; - # Uncomment this for testing, but don't leave it in for "production", as # we've not yet verified that use works. # use strict; -plan (tests => 65); +print "1..65\n"; +my $test = 0; + +sub failed { + my ($got, $expected, $name) = @_; + + print "not ok $test - $name\n"; + my @caller = caller(1); + print "# Failed test at $caller[1] line $caller[2]\n"; + if (defined $got) { + print "# Got '$got'\n"; + } else { + print "# Got undef\n"; + } + print "# Expected $expected\n"; + return; +} + +sub is { + my ($got, $expect, $name) = @_; + $test = $test + 1; + if (defined $expect) { + if (defined $got && $got eq $expect) { + print "ok $test - $name\n"; + return 1; + } + failed($got, "'$expect'", $name); + } else { + if (!defined $got) { + print "ok $test - $name\n"; + return 1; + } + failed($got, 'undef', $name); + } +} $^P = 0xA; @@ -64,7 +96,7 @@ for my $sep (' ', "\0") { eval $prog and die; is (eval "$name()", "This is $name", "Subroutine was compiled, despite error") - or diag $@; + or print STDERR "# $@\n"; check_retained_lines($prog, 'eval that defines subroutine but has syntax error');