From: Jarkko Hietaniemi Date: Mon, 8 Sep 2003 05:21:21 +0000 (+0000) Subject: dumpvar.t: use Test::More; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=96b31d9ef6f02d5fac0d5502d45bc0ba71d292d8;p=p5sagit%2Fp5-mst-13.2.git dumpvar.t: use Test::More; p4raw-id: //depot/perl@21068 --- diff --git a/lib/perl5db/dumpvar.t b/lib/perl5db/dumpvar.t index 4530c3b..08dfe22 100644 --- a/lib/perl5db/dumpvar.t +++ b/lib/perl5db/dumpvar.t @@ -12,35 +12,36 @@ BEGIN { use strict; $|=1; -undef $/; -my @prgs = split "########\n", ; -close DATA; -print "1..", scalar @prgs, "\n"; + +my @prgs; +{ + local $/; + @prgs = split "########\n", ; + close DATA; +} + +use Test::More; + +plan tests => scalar @prgs; + require "dumpvar.pl"; -my $i = 0; -for (@prgs){ - my($prog,$expected) = split(/\nEXPECT\n?/, $_); +for (@prgs) { + my($prog, $expected) = split(/\nEXPECT\n?/, $_); open my $select, ">", \my $got or die; select $select; eval $prog; - my $not = ""; - my $why = ""; - if ($@) { - $not = "not "; - $why = " # prog[$prog]\$\@[$@]"; - } elsif ($got ne $expected) { - $not = "not "; - $why = " # prog[$prog]got[$got]expected[$expected]"; - } + my $ERR = $@; close $select; select STDOUT; - print $not, "ok ", ++$i, $why, "\n"; + if ($ERR) { + ok(0, "$prog - $ERR"); + } else { + is($got, $expected, $prog); + } } __END__ -""; -EXPECT ######## dumpValue(1); EXPECT