From 341b7876042ff99b0d11a456f2139ba2657ef7e2 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 26 Jul 2008 19:51:03 +0000 Subject: [PATCH] Convert yadayada.t to test.pl and strict, and fix two diagnostic errors found in the process. p4raw-id: //depot/perl@34158 --- t/op/yadayada.t | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/t/op/yadayada.t b/t/op/yadayada.t index 9f9e903..deca46c 100644 --- a/t/op/yadayada.t +++ b/t/op/yadayada.t @@ -1,30 +1,34 @@ #!./perl -print "1..5\n"; +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; +} -$err = "Unimplemented at $0 line " . ( __LINE__ + 2 ) . ".\n"; +use strict; + +plan 5; + +my $err = "Unimplemented at $0 line " . ( __LINE__ + 2 ) . ".\n"; eval { ... }; -print "not " unless $@ eq $err; -print "ok 1\n"; -print "# expected: '$err'\n# received: '$@'\n" unless $@ eq $err; +is $@, $err; $err = "foo at $0 line " . ( __LINE__ + 2 ) . ".\n"; eval { !!! "foo" }; -print "not " unless $@ eq $err; -print "ok 2\n"; -print "# expected: '$err'\n# received: '$@'\n" unless $@ eq $err; +is $@, $err; $err = "Died at $0 line " . ( __LINE__ + 2 ) . ".\n"; eval { !!! }; -print "not " unless $@ eq $err; -print "ok 3\n"; -print "# expected: '$err'\n# received: '$@'\n" unless $@ eq $err; +is $@, $err; + +my $warning; local $SIG{__WARN__} = sub { $warning = shift }; @@ -32,14 +36,10 @@ $err = "bar at $0 line " . ( __LINE__ + 2 ) . ".\n"; eval { ??? "bar" }; -print "not " unless $warning eq $err; -print "ok 4\n"; -print "# expected: '$warning'\n# received: '$warningn" unless $warning eq $err; +is $warning, $err; $err = "Warning: something's wrong at $0 line " . ( __LINE__ + 2 ) . ".\n"; eval { ??? }; -print "not " unless $warning eq $err; -print "ok 5\n"; -print "# expected: '$warning'\n# received: '$warningn" unless $warning eq $err; +is $warning, $err; -- 2.7.4