From 95961f2bb1706f8782e09e22425d5958169ef5cd Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 16 Sep 2010 14:07:13 +0200 Subject: change warn.t to use test.pl --- t/op/warn.t | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 't/op') diff --git a/t/op/warn.t b/t/op/warn.t index ec3b9ca67f..571dfb011c 100644 --- a/t/op/warn.t +++ b/t/op/warn.t @@ -1,12 +1,14 @@ #!./perl #line 3 warn.t -print "1..18\n"; -my $test_num = 0; -sub ok { - print $_[0] ? "" : "not ", "ok ", ++$test_num, "\n"; +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; } +plan 18; + my @warnings; my $wa = []; my $ea = []; $SIG{__WARN__} = sub { push @warnings, $_[0] }; @@ -24,7 +26,7 @@ ok @warnings==1 && $warnings[0] eq "foobar\n"; @warnings = (); $@ = ""; warn "foo"; -ok @warnings==1 && $warnings[0] eq "foo at warn.t line 26.\n"; +ok @warnings==1 && $warnings[0] eq "foo at warn.t line 28.\n"; @warnings = (); $@ = ""; @@ -35,13 +37,13 @@ ok @warnings==1 && ref($warnings[0]) eq "ARRAY" && $warnings[0] == $wa; $@ = ""; warn ""; ok @warnings==1 && - $warnings[0] eq "Warning: something's wrong at warn.t line 36.\n"; + $warnings[0] eq "Warning: something's wrong at warn.t line 38.\n"; @warnings = (); $@ = ""; warn; ok @warnings==1 && - $warnings[0] eq "Warning: something's wrong at warn.t line 42.\n"; + $warnings[0] eq "Warning: something's wrong at warn.t line 44.\n"; @warnings = (); $@ = "ERR\n"; @@ -56,7 +58,7 @@ ok @warnings==1 && $warnings[0] eq "foobar\n"; @warnings = (); $@ = "ERR\n"; warn "foo"; -ok @warnings==1 && $warnings[0] eq "foo at warn.t line 58.\n"; +ok @warnings==1 && $warnings[0] eq "foo at warn.t line 60.\n"; @warnings = (); $@ = "ERR\n"; @@ -67,13 +69,13 @@ ok @warnings==1 && ref($warnings[0]) eq "ARRAY" && $warnings[0] == $wa; $@ = "ERR\n"; warn ""; ok @warnings==1 && - $warnings[0] eq "ERR\n\t...caught at warn.t line 68.\n"; + $warnings[0] eq "ERR\n\t...caught at warn.t line 70.\n"; @warnings = (); $@ = "ERR\n"; warn; ok @warnings==1 && - $warnings[0] eq "ERR\n\t...caught at warn.t line 74.\n"; + $warnings[0] eq "ERR\n\t...caught at warn.t line 76.\n"; @warnings = (); $@ = $ea; @@ -88,7 +90,7 @@ ok @warnings==1 && $warnings[0] eq "foobar\n"; @warnings = (); $@ = $ea; warn "foo"; -ok @warnings==1 && $warnings[0] eq "foo at warn.t line 90.\n"; +ok @warnings==1 && $warnings[0] eq "foo at warn.t line 92.\n"; @warnings = (); $@ = $ea; -- cgit v1.2.1