From 4c69f91fc68d8ac41b28d37a76600739a1b39e95 Mon Sep 17 00:00:00 2001 From: Ed J Date: Wed, 1 Jun 2022 22:42:43 +0100 Subject: [PATCH] switch to Test::More, done_testing --- Makefile.PL | 30 +++++++++++++----------- t/001Level.t | 8 +++---- t/002Logger.t | 9 +++----- t/003Layout-Rr.t | 4 ++-- t/003Layout.t | 8 ++----- t/004Config.t | 5 +--- t/005Config-Perl.t | 7 ++---- t/006Config-Java.t | 5 ++-- t/007LogPrio.t | 12 ++++------ t/008ConfCat.t | 17 ++++++-------- t/009Deuce.t | 9 +++----- t/010JConsole.t | 2 ++ t/011JFile.t | 1 + t/012Deeper.t | 1 + t/013Bench.t | 16 +++---------- t/014ConfErrs.t | 2 +- t/015fltmsg.t | 7 +++--- t/016Export.t | 32 +++++++++++-------------- t/017Watch.t | 13 +++-------- t/018Init.t | 9 +++----- t/019Warn.t | 10 ++++---- t/020Easy.t | 5 ++-- t/020Easy2.t | 6 ++--- t/021AppThres.t | 7 ++---- t/022Wrap.t | 7 +++--- t/023Date.t | 8 +++---- t/024WarnDieCarp.t | 13 +++-------- t/025CustLevels.t | 31 ++++++++++--------------- t/026FileApp.t | 14 +++++------ t/027Watch2.t | 15 +++--------- t/027Watch3.t | 5 ++-- t/027Watch4.t | 3 ++- t/028Additivity.t | 25 +++++++++----------- t/029SysWide.t | 20 ++++++++-------- t/030LDLevel.t | 12 ++++------ t/031NDC.t | 16 ++++++------- t/032JRollFile.t | 15 ++++-------- t/033UsrCspec.t | 3 +-- t/034DBI.t | 4 ++-- t/035JDBCAppender.t | 2 +- t/036JSyslog.t | 18 ++++----------- t/037JWin32Event.t | 20 +++++----------- t/038XML-DOM1.t | 10 ++------ t/039XML-DOM2.t | 10 +------- t/040Filter.t | 8 +++---- t/041SafeEval.t | 50 ++++++++++++++++++++-------------------- t/042SyncApp.t | 12 ++++------ t/043VarSubst.t | 6 ++--- t/044XML-Filter.t | 11 +-------- t/045Composite.t | 7 +++--- t/046RRDs.t | 8 ++----- t/047-ldap.t | 19 +++++---------- t/048lwp.t | 6 ++--- t/049Unhide.t | 21 ++++++++--------- t/050Buffer.t | 7 +++--- t/051Extra.t | 7 +++--- t/052Utf8.t | 6 ++--- t/053Resurrect.t | 4 ++-- t/054Subclass.t | 4 ++-- t/055AppDestroy.t | 6 ++--- t/056SyncApp2.t | 5 ++-- t/057MsgChomp.t | 7 +++--- t/058Warnings.t | 5 ++-- t/059Wrapper.t | 18 ++++++--------- t/060Initialized.t | 8 +++---- t/061Multiline.t | 5 ++-- t/062InitHash.t | 5 ++-- t/063LoggerRemove.t | 4 ++-- t/064RealClass.t | 4 ++-- t/065Undef.t | 9 ++++---- t/066SQLite.t | 3 ++- t/067Exception.t | 4 +--- t/068MultilineIndented.t | 4 +++- t/069MoreMultiline.t | 5 ++-- t/070UTCDate.t | 8 +++---- 75 files changed, 298 insertions(+), 454 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 75e719bc..19469e26 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,19 +1,18 @@ +use strict; +use warnings; use ExtUtils::MakeMaker; -# Check for Time::HiRes; -eval { require Time::HiRes; }; -if($@) { - print "Warning: Time::HiRes not installed, but that's ok, " . - "%r will use full seconds\n"; -} - my $meta_merge = { META_MERGE => { "meta-spec" => { version => 2 }, resources => { - repository => 'https://github.com/mschilli/log4perl', + repository => { + type => 'git', + url => 'git@github.com:github.com/mschilli/log4perl.git', + web => 'https://github.com/github.com/mschilli/log4perl', + }, MailingList => 'mailto:log4perl-devel@lists.sourceforge.net', - bugtracker => { + bugtracker => { web => 'https://github.com/mschilli/log4perl/issues', }, }, @@ -28,6 +27,15 @@ my $meta_merge = { 'Log::Dispatch::FileRotate' => '1.10', 'XML::DOM' => '1.29', }, + requires => { + 'File::Spec' => '0.82', + 'File::Path' => '2.07', + }, + }, + test => { + requires => { + 'Test::More' => '0.88', # done_testing + }, }, }, } @@ -36,10 +44,6 @@ my $meta_merge = { WriteMakefile( 'NAME' => 'Log::Log4perl', 'VERSION_FROM' => 'lib/Log/Log4perl.pm', # finds $VERSION - 'PREREQ_PM' => { Test::More => 0.45, - File::Spec => 0.82, - File::Path => 2.07, - }, # e.g., Module::Name => 1.1 ABSTRACT_FROM => 'lib/Log/Log4perl.pm', # retrieve abstract from module AUTHOR => 'Mike Schilli ', MIN_PERL_VERSION => '5.006', diff --git a/t/001Level.t b/t/001Level.t index 381d3f17..b95d81f5 100644 --- a/t/001Level.t +++ b/t/001Level.t @@ -3,11 +3,8 @@ # Mike Schilli, 2002 (m@perlmeister.com) ########################################### -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; use strict; +use Test::More; BEGIN { if($ENV{INTERNAL_DEBUG}) { @@ -16,7 +13,6 @@ BEGIN { } } -BEGIN { plan tests => 34 }; use Log::Log4perl::Level; BEGIN { Log::Log4perl::Level->import("Level"); @@ -59,3 +55,5 @@ ok(Log::Log4perl::Level::isGreaterOrEqual($My::Level::DEBUG, $My::Level::INFO)); ok(Log::Log4perl::Level::isGreaterOrEqual($My::Level::INFO, $My::Level::WARN)); ok(Log::Log4perl::Level::isGreaterOrEqual($My::Level::WARN, $My::Level::ERROR)); ok(Log::Log4perl::Level::isGreaterOrEqual($My::Level::ERROR, $My::Level::FATAL)); + +done_testing; diff --git a/t/002Logger.t b/t/002Logger.t index fd6df461..b782c788 100644 --- a/t/002Logger.t +++ b/t/002Logger.t @@ -12,13 +12,9 @@ BEGIN { } } -use warnings; use strict; - -######################### -# used Test::Simple to help debug the test script -use Test::More tests => 74; - +use warnings; +use Test::More; use Log::Log4perl; use Log::Log4perl::Level; use Log::Log4perl::Util; @@ -401,3 +397,4 @@ is($@, "", "Adding file appender"); eval { $log10->add_appender($app_screen); }; is($@, "", "Adding screen appender"); +done_testing; diff --git a/t/003Layout-Rr.t b/t/003Layout-Rr.t index ba2b5649..e4799637 100644 --- a/t/003Layout-Rr.t +++ b/t/003Layout-Rr.t @@ -10,7 +10,7 @@ BEGIN { use strict; use warnings; -use Test::More tests => 2; +use Test::More; use File::Spec; use Log::Log4perl; @@ -86,6 +86,7 @@ is_deeply( ] ); +done_testing; # # Returns the elapsed times logged so far. @@ -151,4 +152,3 @@ sub create_logger { return $logger; } - diff --git a/t/003Layout.t b/t/003Layout.t index 0b4db86c..c352749c 100644 --- a/t/003Layout.t +++ b/t/003Layout.t @@ -10,15 +10,10 @@ BEGIN { } } -use warnings; use strict; +use warnings; -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### use Test::More; -BEGIN { plan tests => 24 }; - use Log::Log4perl; use Log::Log4perl::Layout; @@ -283,3 +278,4 @@ eval { }; is($app->buffer(), "main::: Thats the\nmain::: multiline\nmain::: message\n"); +done_testing; diff --git a/t/004Config.t b/t/004Config.t index 9f1b6151..c064acc6 100644 --- a/t/004Config.t +++ b/t/004Config.t @@ -10,11 +10,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### use Test::More; -BEGIN { plan tests => 28 }; use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; @@ -404,3 +400,4 @@ END_CONF eval { Log::Log4perl->init( \$conf ); }; is $@, "", "support exclamation comment character [github.com #24]"; +done_testing; diff --git a/t/005Config-Perl.t b/t/005Config-Perl.t index 88ac4fbf..b3ec8168 100644 --- a/t/005Config-Perl.t +++ b/t/005Config-Perl.t @@ -10,12 +10,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### use Test::More; -BEGIN { plan tests => 3 }; - use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; use File::Spec; @@ -56,3 +51,5 @@ $logger->debug("Gurgel"); $data = ; is($data, "005Config-Perl.t $line DEBUG N/A - Gurgel\n"); + +done_testing; diff --git a/t/006Config-Java.t b/t/006Config-Java.t index bf252fef..d2dc87ec 100644 --- a/t/006Config-Java.t +++ b/t/006Config-Java.t @@ -10,9 +10,6 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### use Test::More; our $LOG_DISPATCH_PRESENT = 0; @@ -72,3 +69,5 @@ $data =~ s#\\#/#g; unlink $LOGFILE; is($data, "$exp"); + +done_testing; diff --git a/t/007LogPrio.t b/t/007LogPrio.t index 76834cd9..eac5aa44 100644 --- a/t/007LogPrio.t +++ b/t/007LogPrio.t @@ -10,13 +10,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; -BEGIN { plan tests => 2 }; - - +use Test::More; use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; use File::Spec; @@ -64,4 +58,6 @@ $file $lines[4] FATAL N/A - Gurgel EOT unlink $LOGFILE; -ok($data, "$exp"); +is($data, $exp); + +done_testing; diff --git a/t/008ConfCat.t b/t/008ConfCat.t index 98afbca0..a4d1740b 100644 --- a/t/008ConfCat.t +++ b/t/008ConfCat.t @@ -10,12 +10,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; -BEGIN { plan tests => 3 }; - +use Test::More; use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; @@ -37,8 +32,8 @@ Log::Log4perl->init("$EG_DIR/log4j-manual-2.conf"); my $logger = Log::Log4perl->get_logger("foo.bar.baz"); $logger->debug("Gurgel"); -ok(Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(), - "m#$date_regex \\[N/A\\] DEBUG foo.bar.baz - Gurgel#"); +like(Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(), + qr#$date_regex \[N/A\] DEBUG foo.bar.baz - Gurgel#); ###################################################################### # Test the root logger via inheritance (discovered by Kevin Goess) @@ -52,5 +47,7 @@ Log::Log4perl->init("$EG_DIR/log4j-manual-2.conf"); $logger = Log::Log4perl->get_logger("foo"); $logger->debug("Gurgel"); -ok(Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(), - "m#$date_regex \\[N/A\\] DEBUG foo - Gurgel#"); +like(Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(), + qr#$date_regex \[N/A\] DEBUG foo - Gurgel#); + +done_testing; diff --git a/t/009Deuce.t b/t/009Deuce.t index b8116aca..73d6453d 100644 --- a/t/009Deuce.t +++ b/t/009Deuce.t @@ -11,12 +11,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; -BEGIN { plan tests => 5 }; - +use Test::More; use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; @@ -53,3 +48,5 @@ ok(Log::Log4perl::Appender::TestBuffer->by_name("stdout")->buffer(), 'm#^\S+\s+\[N/A\] \(\S+?:\d+\) - Gurgel$#'); ok(Log::Log4perl::Appender::TestBuffer->by_name("R")->buffer(), 'm#^\S+\s+N/A \'foo\' - Gurgel$#'); + +done_testing; diff --git a/t/010JConsole.t b/t/010JConsole.t index 0ff4eb10..c7596809 100644 --- a/t/010JConsole.t +++ b/t/010JConsole.t @@ -74,3 +74,5 @@ my $rc = is ($result, $expected); if( !$rc ) { warn "Failed with Log::Dispatch $Log::Dispatch::VERSION"; } + +done_testing; diff --git a/t/011JFile.t b/t/011JFile.t index 1985e734..707e2cda 100644 --- a/t/011JFile.t +++ b/t/011JFile.t @@ -61,6 +61,7 @@ EOL is ($result, $expected); reset_logger(); +done_testing; sub reset_logger { local $Log::Log4perl::Config::CONFIG_INTEGRITY_CHECK = 0; # to close handles and allow temp files to go diff --git a/t/012Deeper.t b/t/012Deeper.t index 27a8f2d8..83d3676a 100644 --- a/t/012Deeper.t +++ b/t/012Deeper.t @@ -193,6 +193,7 @@ foreach my $l ($xla, $xlab, $xlabc, $xlabcd, $xlabcde){ is($result, $expected); reset_logger(); +done_testing; sub reset_logger { local $Log::Log4perl::Config::CONFIG_INTEGRITY_CHECK = 0; # to close handles and allow temp files to go diff --git a/t/013Bench.t b/t/013Bench.t index a37267ad..9becd597 100644 --- a/t/013Bench.t +++ b/t/013Bench.t @@ -5,16 +5,14 @@ BEGIN { } } -use Test; +use Test::More; use Benchmark qw/timeit timestr/; use Log::Log4perl; $count = 100_000; unless ($ENV{LOG4PERL_BENCH}) { - print "set \$ENV{LOG4PERL_BENCH} to a true value to run benchmarks, skipping...\n"; - ok(1); - exit; + plan skip_all => "set \$ENV{LOG4PERL_BENCH} to a true value to run benchmarks, skipping...\n"; } $conf = <info('info message')}; print timestr($t),"\n\n"; - - - - - -print - - ok(1); -BEGIN { plan tests => 1, } +done_testing; diff --git a/t/014ConfErrs.t b/t/014ConfErrs.t index f52daceb..baa082d8 100644 --- a/t/014ConfErrs.t +++ b/t/014ConfErrs.t @@ -246,4 +246,4 @@ eval { }; like($@, qr/log4perl.logger.Foo.Bar redefined/); -BEGIN { plan tests => 14, } +done_testing; diff --git a/t/015fltmsg.t b/t/015fltmsg.t index 928403f9..0c7f5aff 100644 --- a/t/015fltmsg.t +++ b/t/015fltmsg.t @@ -11,10 +11,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test::More tests => 5; +use Test::More; use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; @@ -118,3 +115,5 @@ $logger->debug("Chunk1", "Chunk2", "Chunk3"); is($app->buffer(), "[1,Chunk1,Chunk2,Chunk3]", "warp_message = function (by name)"); + +done_testing; diff --git a/t/016Export.t b/t/016Export.t index 89fa5da6..dfd29461 100644 --- a/t/016Export.t +++ b/t/016Export.t @@ -11,16 +11,10 @@ BEGIN { } } -use warnings; use strict; +use warnings; use Log::Log4perl::Appender::TestBuffer; - -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; -BEGIN { plan tests => 16 }; - +use Test::More; use Log::Log4perl qw(get_logger :levels); ok(1); @@ -54,7 +48,7 @@ ok(2); my $log2 = get_logger("abc.def"); $log2->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -63,7 +57,7 @@ $app->buffer(""); my $log3 = get_logger("main"); $log3->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -72,7 +66,7 @@ $app->buffer(""); my $log4 = get_logger("main"); $log4->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -81,7 +75,7 @@ $app->buffer(""); my $log5 = get_logger("main"); $log5->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -90,7 +84,7 @@ $app->buffer(""); my $log6 = get_logger(); $log6->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -99,7 +93,7 @@ $app->buffer(""); my $log7 = Log::Log4perl->get_logger(); $log7->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -108,7 +102,7 @@ $app->buffer(""); my $log8 = Log::Log4perl::get_logger(); $log8->debug("Is this it?"); -ok($app->buffer(), "DEBUG - Is this it?\n"); +is($app->buffer(), "DEBUG - Is this it?\n"); $app->buffer(""); ################################################## @@ -120,7 +114,7 @@ $log8->debug("Is this it?"); $app = Log::Log4perl->appenders()->{"A1"}; -ok($app->buffer(), ""); +is($app->buffer(), ""); $app->buffer(""); ################################################## @@ -128,13 +122,15 @@ $app->buffer(""); ################################################## $Log::Log4perl::Appender::TestBuffer::DESTROY_MESSAGE = ""; Log::Log4perl->eradicate_appender("A1"); -ok($Log::Log4perl::Appender::TestBuffer::DESTROY_MESSAGE, "", +is($Log::Log4perl::Appender::TestBuffer::DESTROY_MESSAGE, "", "destroy message before"); undef $app; # Special for TestBuffer: remove circ ref delete ${Log::Log4perl::Appender::TestBuffer::POPULATION}{A1}; -ok($Log::Log4perl::Appender::TestBuffer::DESTROY_MESSAGES, +is($Log::Log4perl::Appender::TestBuffer::DESTROY_MESSAGES, "Log::Log4perl::Appender::TestBuffer destroyed", "destroy message after destruction"); + +done_testing; diff --git a/t/017Watch.t b/t/017Watch.t index 18944d5c..8f8cc84c 100644 --- a/t/017Watch.t +++ b/t/017Watch.t @@ -7,9 +7,8 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use FindBin qw($Bin); use lib "$Bin/lib"; use Log4perlInternalTest qw( is_like_windows tmpdir ); @@ -22,14 +21,6 @@ sub trunc { close FILE; } -BEGIN { - if ($] < 5.006) { - plan skip_all => "Only with perl >= 5.006"; - } else { - plan tests => 34; - } -} - my $WORK_DIR = tmpdir(); my $testfile = File::Spec->catfile($WORK_DIR, "test17.log"); my $testfile2 = File::Spec->catfile($WORK_DIR, "test17b.log"); @@ -364,3 +355,5 @@ EOL unlink "$testfile.old"; }; + +done_testing; diff --git a/t/018Init.t b/t/018Init.t index b374f729..897a4db2 100644 --- a/t/018Init.t +++ b/t/018Init.t @@ -7,11 +7,9 @@ BEGIN { } } -use Test; - -use warnings; use strict; - +use warnings; +use Test::More; use Log::Log4perl; use File::Spec; use lib File::Spec->catdir(qw(t lib)); @@ -21,8 +19,6 @@ my $WORK_DIR = tmpdir(); my $testfilea = File::Spec->catfile($WORK_DIR, qw(test18a.log)); my $testfileb = File::Spec->catfile($WORK_DIR, qw(test18b.log)); -BEGIN {plan tests => 2} - #################################################### # Double-Init, 2nd time with different log file name #################################################### @@ -59,6 +55,7 @@ for my $file ($testfilea, $testfileb) { } reset_logger(); +done_testing; sub reset_logger { local $Log::Log4perl::Config::CONFIG_INTEGRITY_CHECK = 0; # to close handles and allow temp files to go diff --git a/t/019Warn.t b/t/019Warn.t index c400139e..7495a288 100644 --- a/t/019Warn.t +++ b/t/019Warn.t @@ -7,10 +7,9 @@ BEGIN { } } -use warnings; use strict; - -use Test; +use warnings; +use Test::More; use Log::Log4perl; use File::Spec; use lib File::Spec->catdir(qw(t lib)); @@ -19,8 +18,6 @@ use Log4perlInternalTest qw(tmpdir); my $WORK_DIR = tmpdir(); my $TMP_FILE = File::Spec->catfile($WORK_DIR, qw(warnings)); -BEGIN { plan tests => 2 } - ok(1); # Initialized ok # Capture STDERR to a temporary file and a filehandle to read from it @@ -37,7 +34,8 @@ $log->debug("hey there"); my $warn = readwarn(); #print "'$warn'\n"; -ok($warn, 'm#Forgot#'); +like($warn, qr#Forgot#); +done_testing; __END__ diff --git a/t/020Easy.t b/t/020Easy.t index 5b61f5a2..f7167cab 100644 --- a/t/020Easy.t +++ b/t/020Easy.t @@ -7,9 +7,8 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; use Log::Log4perl qw(:easy); use File::Spec; @@ -233,3 +232,5 @@ like $@, qr/line $line/, "logdie with wrapper"; # Finally close ############################################################ close IN; + +done_testing; diff --git a/t/020Easy2.t b/t/020Easy2.t index abaf450c..6a317c8e 100644 --- a/t/020Easy2.t +++ b/t/020Easy2.t @@ -10,8 +10,8 @@ BEGIN { } } -use warnings; use strict; +use warnings; use Log::Log4perl::Appender::TestBuffer; my $stderr = ""; @@ -21,8 +21,7 @@ $SIG{__WARN__} = sub { $stderr .= $_[0]; }; -use Test::More tests => 3; - +use Test::More; use Log::Log4perl qw(:easy); Log::Log4perl->init(\ q{ @@ -61,3 +60,4 @@ my $log = Log::Log4perl::get_logger(""); $log->trace("We don't want to see this"); is($bufapp->buffer(), "", "Suppressed trace() check"); +done_testing; diff --git a/t/021AppThres.t b/t/021AppThres.t index 492c4c43..7b0df89e 100644 --- a/t/021AppThres.t +++ b/t/021AppThres.t @@ -10,16 +10,12 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; - use Log::Log4perl qw(get_logger); use Log::Log4perl::Level; -BEGIN { plan tests => 24 } - ok(1); # If we made it this far, we're ok. cmp_ok(Log::Log4perl->appender_thresholds_adjust(1), q{==}, 0, @@ -238,3 +234,4 @@ is($app0->buffer(), "INFO - Info\nWARN - Warning\nERROR - Error\n", is($app1->buffer(), "ERROR - Error\n", "appender threshold"); +done_testing; diff --git a/t/022Wrap.t b/t/022Wrap.t index e9aa76fd..0707215f 100644 --- a/t/022Wrap.t +++ b/t/022Wrap.t @@ -10,14 +10,11 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; use File::Basename; -BEGIN { plan tests => 5 } - ################################################## package Wrapper::Log4perl; @@ -129,3 +126,5 @@ is $logger->{category}, "main", "cat on ->() is main"; # use Data::Dumper; # print Dumper($logger); + +done_testing; diff --git a/t/023Date.t b/t/023Date.t index 8779fad9..f0fc3e00 100644 --- a/t/023Date.t +++ b/t/023Date.t @@ -10,13 +10,9 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; - -BEGIN { plan tests => 36 } - use Log::Log4perl qw(get_logger); use Log::Log4perl::DateFormat; use Log::Log4perl::Appender::TestBuffer; @@ -182,3 +178,5 @@ while ( my ( $src, $expected ) = splice @tests, 0, 2 ) { my $got = $df->{fmt} || '(undef)'; is($got, $expected, "literal $src"); } + +done_testing; diff --git a/t/024WarnDieCarp.t b/t/024WarnDieCarp.t index 21ced8be..7b1e8dd4 100644 --- a/t/024WarnDieCarp.t +++ b/t/024WarnDieCarp.t @@ -22,22 +22,13 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; use Log::Log4perl qw(get_logger :easy); use Log::Log4perl::Level; use File::Spec; use Data::Dumper; -BEGIN { - if ($] < 5.006) { - plan skip_all => "Only with perl >= 5.006"; - } else { - plan tests => 73; - } -} - my $warnstr; # this nullifies warns and dies here... so testing the testscript may suck. @@ -402,3 +393,5 @@ eval { }; is $@->{ foo }, "bar", "die without stringify"; + +done_testing; diff --git a/t/025CustLevels.t b/t/025CustLevels.t index 8bf8036b..f16b96bb 100644 --- a/t/025CustLevels.t +++ b/t/025CustLevels.t @@ -11,17 +11,14 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; +use strict; +use warnings; +use Test::More; #create a custom level "LITEWARN" use Log::Log4perl; use Log::Log4perl::Level; use Log::Log4perl::Appender::TestBuffer; -# use strict; - ok(1); # If we made it this far, we're ok. @@ -32,7 +29,7 @@ Log::Log4perl::Logger::create_custom_level("DEBUG2", "DEBUG"); # test insane creation of levels foreach (1 .. 14) { - ok(Log::Log4perl::Logger::create_custom_level("TEST$_", "INFO"), 0); + is(Log::Log4perl::Logger::create_custom_level("TEST$_", "INFO"), 0); } # 15th should fail.. this assumes that each level is 10000 apart from @@ -64,7 +61,7 @@ my %btree = ( foreach (8, 4, 2, 1, 3, 6, 5, 7, 12, 10, 9, 11, 14, 13, 15) { my $level = $btree{$_} eq "DEBUG" ? "DEBUG" : "BTREE$btree{$_}"; # warn("Creating BTREE$_ after $level"); - ok(Log::Log4perl::Logger::create_custom_level("BTREE$_", $level), 0); + is(Log::Log4perl::Logger::create_custom_level("BTREE$_", $level), 0); # warn("BTREE$_ is ", ${Log::Log4perl::Level::PRIORITY{"BTREE$_"}}); } @@ -72,7 +69,6 @@ foreach (8, 4, 2, 1, 3, 6, 5, 7, 12, 10, 9, 11, 14, 13, 15) { # warn("BTREE$_ is: ", ${Log::Log4perl::Level::PRIORITY{"BTREE$_"}}); # } - my $LOGFILE = "example$$.log"; unlink $LOGFILE; @@ -86,10 +82,8 @@ log4j.category.debug2test = DEBUG2, FileAppndr log4j.additivity.debug2test= 0 EOT - Log::Log4perl::init(\$config); - # can't create a custom level after init... let's test that. Just look # for an undef (i.e. failure) from the eval @@ -110,7 +104,7 @@ $/ = undef; my $data = ; close FILE; my $result1 = "WARN - this is a warning message\nLITEWARN - this is a LITE warning message (2/3 the calories)\n"; -ok($data, $result1); +is($data, $result1); # ********************* # check the root logger @@ -124,11 +118,10 @@ $/ = undef; $data = ; close FILE; my $result2 = "WARN - this is a rootlevel warning message\nLITEWARN - this is a rootlevel LITE warning message (2/3 the calories)\n"; -ok($data, "$result1$result2"); +is($data, "$result1$result2"); $logger->log($WARN, "a warning message"); -$logger->log($LITEWARN, "a LITE warning message"); -die("lame hack to suppress warning") if ($LITEWARN != $LITEWARN); +$logger->log(Log::Log4perl::Level::to_priority("LITEWARN"), "a LITE warning message"); $logger->log($DEBUG, "an info message, should not log"); open FILE, "<$LOGFILE" or die "Cannot open $LOGFILE"; @@ -148,7 +141,7 @@ $/ = undef; $data = ; close FILE; my $result4 = "DEBUG2 - this is a debug2 message\n"; -ok($data, "$result1$result2$result3$result4"); +is($data, "$result1$result2$result3$result4"); #********************* #check the is_* methods @@ -173,7 +166,7 @@ $/ = undef; $data = ; close FILE; my $result5 = "WARN - after bumping, warning message\n"; -ok($data, "$result1$result2$result3$result4$result5"); +is($data, "$result1$result2$result3$result4$result5"); $logger->dec_level(2); #bump down from warn to litewarn to info @@ -203,6 +196,6 @@ $logger->less_logging(150); # should be OFF now ok(!($logger->is_fatal() || $logger->is_error() || $logger->is_warn() || $logger->is_info() || $logger->is_debug())); -BEGIN { plan tests => 51 }; - unlink $LOGFILE; + +done_testing; diff --git a/t/026FileApp.t b/t/026FileApp.t index 7cd48e97..9562c453 100644 --- a/t/026FileApp.t +++ b/t/026FileApp.t @@ -7,11 +7,9 @@ BEGIN { } } -use Test::More; - -use warnings; use strict; - +use warnings; +use Test::More; use Log::Log4perl; use File::Spec; use FindBin qw($Bin); @@ -31,8 +29,6 @@ my $WORK_DIR = tmpdir(); my $testfile = File::Spec->catfile($WORK_DIR, "test26.log"); my $testpath = File::Spec->catdir($WORK_DIR, "test26"); -BEGIN {plan tests => 27} - #################################################### # First, preset the log file with some content #################################################### @@ -42,7 +38,7 @@ close FILE; #################################################### # Append to a log file without specifying append mode -# explicitely +# explicitly #################################################### my $data = <catdir(qw(t lib)); use Log4perlInternalTest qw(tmpdir); -BEGIN { - if ($] < 5.006) { - plan skip_all => "Only with perl >= 5.006"; - } else { - plan tests => 21; - } -} - my $WORK_DIR = tmpdir(); my $testconf = File::Spec->catfile($WORK_DIR, "test27.conf"); @@ -189,6 +179,7 @@ sleep(2); ERROR("fourth"); like $buf->buffer(), qr/main-main:: 027Watch2.t/, "[rt.cpan.org #60386] caller level check"; +done_testing; ########################################### sub conf_file_write { diff --git a/t/027Watch3.t b/t/027Watch3.t index 3256c667..eafdb7fe 100644 --- a/t/027Watch3.t +++ b/t/027Watch3.t @@ -8,8 +8,8 @@ BEGIN { } } -use warnings; use strict; +use warnings; use Test::More; use File::Spec; use lib File::Spec->catdir(qw(t lib)); @@ -17,7 +17,6 @@ use Log4perlInternalTest qw(tmpdir need_signals); BEGIN { need_signals(); - plan tests => 15; } use Log::Log4perl; @@ -120,3 +119,5 @@ $logger = Log::Log4perl::get_logger('animal.cat'); $logger->info('warning message to cat, should appear'); like($app1->buffer(), qr/(WARN - warning message, should appear\n){2}INFO - warning message to cat, should appear/, "message output"); + +done_testing; diff --git a/t/027Watch4.t b/t/027Watch4.t index b28f36d3..44d45121 100644 --- a/t/027Watch4.t +++ b/t/027Watch4.t @@ -17,7 +17,6 @@ use Log4perlInternalTest qw(need_signals); BEGIN { need_signals(); - plan tests => 4; } my $EG_DIR = "eg"; @@ -48,3 +47,5 @@ is($Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_CHECKED, 1, "change checked after force_next_check()"); is($Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_DETECTED, 0, "no change detected after force_next_check()"); + +done_testing; diff --git a/t/028Additivity.t b/t/028Additivity.t index 118d09a8..e0545fa5 100644 --- a/t/028Additivity.t +++ b/t/028Additivity.t @@ -10,12 +10,7 @@ BEGIN { } } -######################### -# change 'tests => 1' to 'tests => last_test_to_print'; -######################### -use Test; -BEGIN { plan tests => 9 }; - +use Test::More; use Log::Log4perl qw(get_logger :levels); use Log::Log4perl::Appender::TestBuffer; @@ -42,8 +37,8 @@ $logger->info("Percolate this!"); my $buf1 = Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(); my $buf2 = Log::Log4perl::Appender::TestBuffer->by_name("A2")->buffer(); -ok($buf1, "INFO - Percolate this!\n"); -ok($buf2, "INFO - Percolate this!\n"); +is($buf1, "INFO - Percolate this!\n"); +is($buf2, "INFO - Percolate this!\n"); Log::Log4perl::Appender::TestBuffer->reset(); @@ -66,8 +61,8 @@ $logger->info("Percolate this!"); $buf1 = Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(); $buf2 = Log::Log4perl::Appender::TestBuffer->by_name("A2")->buffer(); -ok($buf1, ""); # Not supposed to show up in the root logger -ok($buf2, "INFO - Percolate this!\n"); +is($buf1, ""); # Not supposed to show up in the root logger +is($buf2, "INFO - Percolate this!\n"); Log::Log4perl::Appender::TestBuffer->reset(); @@ -90,8 +85,8 @@ $logger->info("Percolate this!"); $buf1 = Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(); $buf2 = Log::Log4perl::Appender::TestBuffer->by_name("A2")->buffer(); -ok($buf1, "INFO - Percolate this!\n"); -ok($buf2, "INFO - Percolate this!\n"); +is($buf1, "INFO - Percolate this!\n"); +is($buf2, "INFO - Percolate this!\n"); Log::Log4perl::Appender::TestBuffer->reset(); @@ -118,7 +113,9 @@ $logger->info("Only for Twix"); $buf1 = Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(); $buf2 = Log::Log4perl::Appender::TestBuffer->by_name("A2")->buffer(); -ok($buf1, ""); -ok($buf2, "INFO - Only for Twix\n"); +is($buf1, ""); +is($buf2, "INFO - Only for Twix\n"); Log::Log4perl::Appender::TestBuffer->reset(); + +done_testing; diff --git a/t/029SysWide.t b/t/029SysWide.t index 353610ee..dac9e60c 100644 --- a/t/029SysWide.t +++ b/t/029SysWide.t @@ -10,17 +10,13 @@ BEGIN { } } -use warnings; use strict; - -use Test; - +use warnings; +use Test::More; use Log::Log4perl qw(get_logger); use Log::Log4perl::Level; use Log::Log4perl::Appender::TestBuffer; -BEGIN { plan tests => 6 } - ok(1); # If we made it this far, we're ok. ################################################## @@ -45,7 +41,7 @@ my $loga = get_logger("a"); $loga->info("Don't want to see this"); $loga->error("Yeah, loga"); -ok($app0->buffer(), "ERROR - Yeah, loga\n"); +is($app0->buffer(), "ERROR - Yeah, loga\n"); ################################################## # System-wide threshold with appender threshold @@ -75,8 +71,8 @@ $loga = get_logger("a"); $loga->info("Don't want to see this"); $loga->error("Yeah, loga"); -ok($app0->buffer(), "ERROR - Yeah, loga\n"); -ok($app1->buffer(), "ERROR - Yeah, loga\n"); +is($app0->buffer(), "ERROR - Yeah, loga\n"); +is($app1->buffer(), "ERROR - Yeah, loga\n"); ############################################################ # System-wide threshold shouldn't lower appender thresholds @@ -98,7 +94,7 @@ my $logger = get_logger(); $logger->info("Blah"); $app0 = Log::Log4perl::Appender::TestBuffer->by_name("BUF0"); -ok($app0->buffer(), "", "syswide threshold shouldn't lower app thresholds"); +is($app0->buffer(), "", "syswide threshold shouldn't lower app thresholds"); ############################################################ # System-wide threshold shouldn't lower appender thresholds @@ -120,4 +116,6 @@ $logger = get_logger(); $logger->warn("Blah"); $app0 = Log::Log4perl::Appender::TestBuffer->by_name("BUF0"); -ok($app0->buffer(), "", "syswide threshold trumps thresholds"); +is($app0->buffer(), "", "syswide threshold trumps thresholds"); + +done_testing; diff --git a/t/030LDLevel.t b/t/030LDLevel.t index 7594d32e..6d11ea33 100644 --- a/t/030LDLevel.t +++ b/t/030LDLevel.t @@ -10,17 +10,13 @@ BEGIN { } } -use warnings; use strict; - -use Test; - +use warnings; +use Test::More; use Log::Log4perl qw(get_logger); use Log::Log4perl::Level; use Log::Log4perl::Appender::TestBuffer; -BEGIN { plan tests => 2 } - ok(1); # If we made it this far, we're ok. # Have TestBuffer log the Log::Dispatch priority @@ -45,7 +41,7 @@ $loga->warn("warn"); $loga->error("error"); $loga->fatal("fatal"); -ok($app0->buffer(), +is($app0->buffer(), "[0]: DEBUG - debug\n" . "[1]: INFO - info\n" . "[3]: WARN - warn\n" . @@ -53,3 +49,5 @@ ok($app0->buffer(), "[7]: FATAL - fatal\n" . "" ); + +done_testing; diff --git a/t/031NDC.t b/t/031NDC.t index db8dbc31..0763085d 100644 --- a/t/031NDC.t +++ b/t/031NDC.t @@ -10,19 +10,15 @@ BEGIN { } } -use warnings; use strict; - -use Test; - +use warnings; +use Test::More; use Log::Log4perl qw(get_logger); use Log::Log4perl::Level; use Log::Log4perl::Appender::TestBuffer; use Log::Log4perl::NDC; use Log::Log4perl::MDC; -BEGIN { plan tests => 3 } - # Have TestBuffer log the Log::Dispatch priority Log::Log4perl::Appender::TestBuffer->reset(); @@ -57,7 +53,7 @@ $loga->warn("warn"); Log::Log4perl::NDC->push("seventh"); $loga->error("error"); -ok($app0->buffer(), +is($app0->buffer(), "debug info warn <[undef]>error "); Log::Log4perl::Appender::TestBuffer->reset(); @@ -80,7 +76,7 @@ my $logb = get_logger("b"); $logb->debug("testmessage"); -ok($app1->buffer(), +is($app1->buffer(), "blah-host: testmessage blah-ip\n"); # Check what happens if %X is used with an undef value @@ -101,5 +97,7 @@ $logb = get_logger("b"); $logb->debug("testmessage"); -ok($app1->buffer(), +is($app1->buffer(), "[undef]: testmessage blah-ip\n"); + +done_testing; diff --git a/t/032JRollFile.t b/t/032JRollFile.t index 998b584b..02c07310 100644 --- a/t/032JRollFile.t +++ b/t/032JRollFile.t @@ -11,16 +11,10 @@ use File::Spec; use lib File::Spec->catdir(qw(t lib)); use Log4perlInternalTest qw(tmpdir); -BEGIN { - eval { - require Log::Dispatch::FileRotate; - }; - if ($@ or $Log::Dispatch::FileRotate::VERSION < 1.10) { - plan skip_all => "only with Log::Dispatch::FileRotate 1.10"; - } else { - plan tests => 2; - } -} +eval { + require Log::Dispatch::FileRotate; + Log::Dispatch::FileRotate->VERSION(1.10); 1 +} or plan skip_all => "only with Log::Dispatch::FileRotate 1.10"; my $WORK_DIR = tmpdir(); @@ -57,6 +51,7 @@ like($result, qr/^INFO cat1 - x+info message 1/); ok(! -e File::Spec->catfile($WORK_DIR, 'rolltest.log.3')); reset_logger(); +done_testing; sub reset_logger { local $Log::Log4perl::Config::CONFIG_INTEGRITY_CHECK = 0; # to close handles and allow temp files to go diff --git a/t/033UsrCspec.t b/t/033UsrCspec.t index 36651bef..67be89a4 100644 --- a/t/033UsrCspec.t +++ b/t/033UsrCspec.t @@ -14,7 +14,6 @@ use File::Spec; Log::Log4perl::Appender::TestBuffer->reset(); - my $config = <<'EOL'; log4j.category.plant = DEBUG, appndr1 log4j.category.animal = DEBUG, appndr2 @@ -311,4 +310,4 @@ $somebuffer = Log::Log4perl::Appender::TestBuffer->by_name("appndr"); is($somebuffer->buffer(), "main blah\n"); -BEGIN { plan tests => 17, } +done_testing; diff --git a/t/034DBI.t b/t/034DBI.t index 1507eed3..62da48e7 100644 --- a/t/034DBI.t +++ b/t/034DBI.t @@ -14,14 +14,13 @@ BEGIN { use Test::More; use Log::Log4perl; -use warnings; use strict; +use warnings; use lib File::Spec->catdir(qw(t lib)); use Log4perlInternalTest qw(tmpdir min_version); BEGIN { min_version(qw( DBI DBD::CSV SQL::Statement )); - plan tests => 11; } require DBI; @@ -248,6 +247,7 @@ is_deeply $got, [ 'WARN', "test message", '' ], "dbi insert with NULL values" or } reset_logger(); +done_testing; sub reset_logger { local $Log::Log4perl::Config::CONFIG_INTEGRITY_CHECK = 0; # to close handles and allow temp files to go diff --git a/t/035JDBCAppender.t b/t/035JDBCAppender.t index c7d8b750..0fd7583d 100644 --- a/t/035JDBCAppender.t +++ b/t/035JDBCAppender.t @@ -118,4 +118,4 @@ is($row->[7], 'bar'); $dbh->do("DROP TABLE $table_name"); -1; +done_testing; diff --git a/t/036JSyslog.t b/t/036JSyslog.t index e3708d32..f0106427 100644 --- a/t/036JSyslog.t +++ b/t/036JSyslog.t @@ -6,20 +6,10 @@ BEGIN { } use Log::Log4perl; -use Test; - -BEGIN {plan tests => 1} -ok(1); #always succeed +use Test::More; #skipping on win32 systems -eval { - require Sys::Syslog; -}; -if ($@){ - print STDERR "Sys::Syslog not installed, skipping...\n"; - exit; -} - +eval { require Sys::Syslog; 1 } or plan skip_all => "Sys::Syslog not installed"; print <enable(); @@ -8,16 +8,9 @@ BEGIN { use Log::Log4perl; use Test::More; - #skipping on non-win32 systems -BEGIN { - eval { - require Log::Dispatch::Win32EventLog; - }; - if ($@){ - plan skip_all => "only with Log::Dispatch::Win32EventLog"; - } -}; +eval { require Log::Dispatch::Win32EventLog; 1 } or + plan skip_all => "only with Log::Dispatch::Win32EventLog"; print <debug("debugging message 1 "); $logger->info("info message 1 "); $logger->warn("warning message 1 "); - -BEGIN {plan tests => 1} - #if we didn't die, we got here ok(1); + +done_testing; diff --git a/t/038XML-DOM1.t b/t/038XML-DOM1.t index 7821b601..b7287198 100644 --- a/t/038XML-DOM1.t +++ b/t/038XML-DOM1.t @@ -1,4 +1,3 @@ - BEGIN { if($ENV{INTERNAL_DEBUG}) { require Log::Log4perl::InternalDebug; @@ -35,16 +34,9 @@ BEGIN { }; if ($@) { plan skip_all => "only with XML::DOM > $dvrq"; - }else{ - plan tests => 2; } } -if ($no_XMLDOM){ - ok(1); - exit(0); -} - my $WORK_DIR = tmpdir(); my $xmlconfig = < @@ -284,3 +276,5 @@ my $logger = Log::Log4perl->get_logger(); $logger->info("Info"); $logger->debug("Debug"); + +done_testing; diff --git a/t/039XML-DOM2.t b/t/039XML-DOM2.t index cbf2d99a..ec5eb981 100644 --- a/t/039XML-DOM2.t +++ b/t/039XML-DOM2.t @@ -30,16 +30,9 @@ BEGIN { }; if ($@) { plan skip_all => "only with XML::DOM > $dvrq"; - }else{ - plan tests => 4; } } -if ($no_XMLDOM){ - ok(1); - exit(0); -} - my $WORK_DIR = tmpdir(); my $xmlconfig = < @@ -345,8 +338,6 @@ $ENV{perlcode} = 'return "UID $< GID $(";'; my $varsubstdata = Log::Log4perl::Config::config_read(\$varsubstconfig); - - ok(Compare($xmldata, $propsdata)) || do { if ($dump_available) { @@ -355,3 +346,4 @@ ok(Compare($xmldata, $propsdata)) || } }; +done_testing; diff --git a/t/040Filter.t b/t/040Filter.t index a4a0cb8c..3300ebc1 100644 --- a/t/040Filter.t +++ b/t/040Filter.t @@ -10,11 +10,9 @@ BEGIN { } } -use warnings; use strict; - -use Test::More tests => 36; - +use warnings; +use Test::More; use Log::Log4perl; ############################################# @@ -514,3 +512,5 @@ Log::Log4perl->reset(); $buffer->reset(); *{ Log::Log4perl::Filter::LevelMatch::ok } = $old_level_match_ok; + +done_testing; diff --git a/t/041SafeEval.t b/t/041SafeEval.t index 41dc3136..45600f7c 100644 --- a/t/041SafeEval.t +++ b/t/041SafeEval.t @@ -11,9 +11,7 @@ BEGIN { } } -use Test; -BEGIN { plan tests => 23 }; - +use Test::More; use Log::Log4perl; ok(1); # If we made it this far, we're ok. @@ -35,34 +33,34 @@ my $config = <<'END'; END eval { Log::Log4perl->init( \$config ) }; my $failed = $@ ? 1 : 0; -ok($failed, 0, 'config file with code initializes successfully'); +is($failed, 0, 'config file with code initializes successfully'); # test that disallowing code works properly Log::Log4perl::Config->allow_code(0); eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 1, 'config file with code fails if ALLOW_CODE_IN_CONFIG_FILE is false'); +is($failed, 1, 'config file with code fails if ALLOW_CODE_IN_CONFIG_FILE is false'); # test that providing an explicit mask causes illegal code to fail Log::Log4perl::Config->allow_code(1); Log::Log4perl::Config->allowed_code_ops(':default'); eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 1, 'config file with code fails if ALLOW_CODE_IN_CONFIG_FILE is true and an explicit mask is set'); +is($failed, 1, 'config file with code fails if ALLOW_CODE_IN_CONFIG_FILE is true and an explicit mask is set'); # test that providing an restrictive convenience mask causes illegal code to fail Log::Log4perl::Config::allow_code('restrictive'); undef @Log::Log4perl::ALLOWED_CODE_OPS_IN_CONFIG_FILE; eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 1, 'config file with code fails if ALLOW_CODE_IN_CONFIG_FILE is true and a restrictive convenience mask is set'); +is($failed, 1, 'config file with code fails if ALLOW_CODE_IN_CONFIG_FILE is true and a restrictive convenience mask is set'); # test that providing an restrictive convenience mask causes illegal code to fail Log::Log4perl::Config->allow_code('safe'); undef @Log::Log4perl::ALLOWED_CODE_OPS_IN_CONFIG_FILE; eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 0, 'config file with code succeeds if ALLOW_CODE_IN_CONFIG_FILE is true and a safe convenience mask is set'); +is($failed, 0, 'config file with code succeeds if ALLOW_CODE_IN_CONFIG_FILE is true and a safe convenience mask is set'); ################################################## # Test allowed_code_ops_convenience_map accessors @@ -70,29 +68,29 @@ ok($failed, 0, 'config file with code succeeds if ALLOW_CODE_IN_CONFIG_FILE is t # get entire map as hashref my $map = Log::Log4perl::Config->allowed_code_ops_convenience_map(); -ok(ref $map, 'HASH', 'entire map is returned as a hashref'); +is(ref $map, 'HASH', 'entire map is returned as a hashref'); my $numkeys = keys %{ $map }; # get entire map as hash my %map = Log::Log4perl::Config->allowed_code_ops_convenience_map(); -ok(keys %map, $numkeys, 'entire map returned as hash has same number of keys as hashref'); +is(scalar keys %map, $numkeys, 'entire map returned as hash has same number of keys as hashref'); # replace entire map Log::Log4perl::Config->allowed_code_ops_convenience_map( {} ); -ok(keys %{ Log::Log4perl::Config->allowed_code_ops_convenience_map() }, 0, +is(scalar keys %{ Log::Log4perl::Config->allowed_code_ops_convenience_map() }, 0, 'can replace entire map with an empty one'); Log::Log4perl::Config->allowed_code_ops_convenience_map( \%map ); -ok(keys %{ Log::Log4perl::Config->allowed_code_ops_convenience_map() }, $numkeys, +is(scalar keys %{ Log::Log4perl::Config->allowed_code_ops_convenience_map() }, $numkeys, 'can replace entire map with an populated one'); # Add a new name/mask to the map Log::Log4perl::Config->allowed_code_ops_convenience_map( foo => [ ':default' ] ); -ok( keys %{ Log::Log4perl::Config->allowed_code_ops_convenience_map() }, +is( scalar keys %{ Log::Log4perl::Config->allowed_code_ops_convenience_map() }, $numkeys + 1, 'can add a new name/mask to the map'); # get the mask we just added back my $mask = Log::Log4perl::Config->allowed_code_ops_convenience_map( 'foo' ); -ok( $mask->[0], ':default', 'can retrieve a single mask'); +is( $mask->[0], ':default', 'can retrieve a single mask'); ################################################### # Test vars_shared_with_safe_compartment accessors @@ -100,19 +98,19 @@ ok( $mask->[0], ':default', 'can retrieve a single mask'); # get entire varlist as hashref $map = Log::Log4perl::Config->vars_shared_with_safe_compartment(); -ok(ref $map, 'HASH', 'entire map is returned as a hashref'); +is(ref $map, 'HASH', 'entire map is returned as a hashref'); $numkeys = keys %{ $map }; # get entire map as hash %map = Log::Log4perl::Config->vars_shared_with_safe_compartment(); -ok(keys %map, $numkeys, 'entire map returned as hash has same number of keys as hashref'); +is(scalar keys %map, $numkeys, 'entire map returned as hash has same number of keys as hashref'); # replace entire map Log::Log4perl::Config->vars_shared_with_safe_compartment( {} ); -ok(keys %{ Log::Log4perl::Config->vars_shared_with_safe_compartment() }, 0, +is(scalar keys %{ Log::Log4perl::Config->vars_shared_with_safe_compartment() }, 0, 'can replace entire map with an empty one'); Log::Log4perl::Config->vars_shared_with_safe_compartment( \%map ); -ok(keys %{ Log::Log4perl::Config->vars_shared_with_safe_compartment() }, $numkeys, +is(scalar keys %{ Log::Log4perl::Config->vars_shared_with_safe_compartment() }, $numkeys, 'can replace entire map with an populated one'); # Add a new name/mask to the map @@ -120,13 +118,13 @@ $Foo::foo = 1; @Foo::bar = ( 1, 2, 3 ); push @Foo::bar, $Foo::foo; # Some nonsense to avoid 'used only once' warning Log::Log4perl::Config->vars_shared_with_safe_compartment( Foo => [ '$foo', '@bar' ] ); -ok( keys %{ Log::Log4perl::Config->vars_shared_with_safe_compartment() }, +is( scalar keys %{ Log::Log4perl::Config->vars_shared_with_safe_compartment() }, $numkeys + 1, 'can add a new name/mask to the map'); # get the varlist we just added back my $varlist = Log::Log4perl::Config->vars_shared_with_safe_compartment( 'Foo' ); -ok( $varlist->[0], '$foo', 'can retrieve a single varlist'); -ok( $varlist->[1], '@bar', 'can retrieve a single varlist'); +is( $varlist->[0], '$foo', 'can retrieve a single varlist'); +is( $varlist->[1], '@bar', 'can retrieve a single varlist'); ############################################ @@ -145,7 +143,7 @@ Log::Log4perl::Config::allow_code('restrictive'); undef @Log::Log4perl::ALLOWED_CODE_OPS_IN_CONFIG_FILE; eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 1, +is($failed, 1, 'global cspec with harmful code rejected on restrictive setting'); # Global cspec with legal code @@ -160,7 +158,7 @@ Log::Log4perl::Config->allow_code('restrictive'); undef @Log::Log4perl::ALLOWED_CODE_OPS_IN_CONFIG_FILE; eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 0, 'global cspec with legal code allowed on restrictive setting'); +is($failed, 0, 'global cspec with legal code allowed on restrictive setting'); # Local cspec with illegal code $config = <<'END'; @@ -173,7 +171,7 @@ Log::Log4perl::Config::allow_code('restrictive'); undef @Log::Log4perl::ALLOWED_CODE_OPS_IN_CONFIG_FILE; eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 1, 'local cspec with harmful code rejected on restrictive setting'); +is($failed, 1, 'local cspec with harmful code rejected on restrictive setting'); # Global cspec with legal code $config = <<'END'; @@ -186,6 +184,8 @@ Log::Log4perl::Config::allow_code('restrictive'); undef @Log::Log4perl::ALLOWED_CODE_OPS_IN_CONFIG_FILE; eval { Log::Log4perl->init( \$config ) }; $failed = $@ ? 1 : 0; -ok($failed, 0, 'local cspec with legal code allowed on restrictive setting'); +is($failed, 0, 'local cspec with legal code allowed on restrictive setting'); unlink($example_log); + +done_testing; diff --git a/t/042SyncApp.t b/t/042SyncApp.t index 9adb1074..fe8479c4 100644 --- a/t/042SyncApp.t +++ b/t/042SyncApp.t @@ -13,24 +13,18 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($DEBUG); use constant INTERNAL_DEBUG => 0; - our $INTERNAL_DEBUG = 0; $| = 1; BEGIN { - if(exists $ENV{"L4P_ALL_TESTS"}) { - plan tests => 5; - } else { - plan skip_all => "- only with L4P_ALL_TESTS"; - } +plan skip_all => "- only with L4P_ALL_TESTS" if !exists $ENV{"L4P_ALL_TESTS"}; } use Log::Log4perl::Util::Semaphore; @@ -349,3 +343,5 @@ my $locker4 = Log::Log4perl::Util::Semaphore->new( $locker1->remove; $locker3->remove; + +done_testing; diff --git a/t/043VarSubst.t b/t/043VarSubst.t index 90c5da4c..1cfb498f 100644 --- a/t/043VarSubst.t +++ b/t/043VarSubst.t @@ -11,11 +11,9 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; -BEGIN { plan tests => 8 } use Log::Log4perl qw(get_logger); ######################################################## @@ -139,3 +137,5 @@ $buffer = Log::Log4perl::Appender::TestBuffer->by_name("Logfile"); like($buffer->buffer, qr/foobar/); $buffer = Log::Log4perl::Appender::TestBuffer->by_name("Screen"); like($buffer->buffer, qr/foobar/); + +done_testing; diff --git a/t/044XML-Filter.t b/t/044XML-Filter.t index 4e3549f3..c816e1ce 100644 --- a/t/044XML-Filter.t +++ b/t/044XML-Filter.t @@ -34,17 +34,9 @@ BEGIN { }; if ($@) { plan skip_all => "only with XML::DOM > $dvrq"; - }else{ - plan tests => 3; } } -if ($no_XMLDOM){ - ok(1); - exit(0); -} - - #brute force testing here, not very granular, but it is thorough eval {require Data::Dump}; @@ -253,5 +245,4 @@ ok(Compare($xmldata, $propsdata)) || } }; - - +done_testing; diff --git a/t/045Composite.t b/t/045Composite.t index adcc06a8..a09c1767 100644 --- a/t/045Composite.t +++ b/t/045Composite.t @@ -10,9 +10,8 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; BEGIN { @@ -23,8 +22,6 @@ BEGIN { plan skip_all => "only with Storable"; # Limit.pm needs it and # early Perl versions dont # have it. - }else{ - plan tests => 20; } } @@ -370,3 +367,5 @@ $composite->flush(); is $buffer->buffer(), "", "appender threshold blocks message in composite appender"; + +done_testing; diff --git a/t/046RRDs.t b/t/046RRDs.t index d1b35d41..ab0c1175 100644 --- a/t/046RRDs.t +++ b/t/046RRDs.t @@ -10,11 +10,9 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; - use Log::Log4perl qw(get_logger); my $DB = "myrrddb.dat"; @@ -22,9 +20,6 @@ my $DB = "myrrddb.dat"; BEGIN { eval 'require RRDs'; if($@) { plan skip_all => "(RRDs not installed)"; - exit 0; - } else { - plan tests => 1; } }; END { unlink $DB }; @@ -58,3 +53,4 @@ $data = join ' - ', map { "@$_" } grep { defined $_->[0] } @$data; #print $data; like($data, qr/\d\d/); +done_testing; diff --git a/t/047-ldap.t b/t/047-ldap.t index 06dfce71..921b8506 100644 --- a/t/047-ldap.t +++ b/t/047-ldap.t @@ -48,15 +48,9 @@ use Test::More; use Log::Log4perl qw(get_logger); -BEGIN { - if ($ENV{L4P_DO_LDAP_TESTS}) { - require Net::LDAP; - require URI::ldap; - plan tests => 1; - }else{ - plan skip_all => 'L4P_DO_LDAP_TESTS not set' - } -} +plan skip_all => 'L4P_DO_LDAP_TESTS not set' if !$ENV{L4P_DO_LDAP_TESTS}; +require Net::LDAP; +require URI::ldap; Log::Log4perl->init(\qq{ log4perl.category = INFO, LDAPapp @@ -65,7 +59,6 @@ Log::Log4perl->init(\qq{ log4perl.appender.LDAPapp.layout.ConversionPattern = N:%m }); - my $uri = URI->new("ldap:"); # start empty $uri->host($ENV{LDAP_HOST}); #see above for run values @@ -129,8 +122,8 @@ EOL my $propsdata = Log::Log4perl::Config::config_read(\$propsconfig); -use Data::Dump qw(dump); #DEBUG -dump $ldapdata; +diag explain $ldapdata; print STDERR "\n--------------\n"; -dump $propsdata; +diag explain $propsdata; is_deeply($ldapdata, $propsdata); +done_testing; diff --git a/t/048lwp.t b/t/048lwp.t index 5749ff52..7540f1f6 100644 --- a/t/048lwp.t +++ b/t/048lwp.t @@ -10,8 +10,8 @@ BEGIN { } } -use warnings; use strict; +use warnings; use Test::More; @@ -24,8 +24,6 @@ BEGIN { if($@) { plan skip_all => "Only with 2.0 < LWP::UserAgent < 5.822 "; - } else { - plan tests => 3; } } @@ -96,3 +94,5 @@ $data = join('', ); close LOG; like($data, qr#LWP/UserAgent.pm-\d+#); + +done_testing; diff --git a/t/049Unhide.t b/t/049Unhide.t index 2d64281c..2edc4ec4 100644 --- a/t/049Unhide.t +++ b/t/049Unhide.t @@ -16,20 +16,15 @@ use strict; use Test::More; use Log::Log4perl::Appender::TestBuffer; -BEGIN { - eval { - require Filter::Util::Call; - }; - - if($@) { - plan skip_all => "Filter::Util::Call not available"; - } else { - plan tests => 1; - } -} - use Log::Log4perl qw(:easy :resurrect); +eval { + require Filter::Util::Call; +}; +if($@) { + plan skip_all => "Filter::Util::Call not available"; +} + Log::Log4perl->easy_init($DEBUG); Log::Log4perl::Appender::TestBuffer->reset(); @@ -48,3 +43,5 @@ DEBUG "third"; is(Log::Log4perl::Appender::TestBuffer->by_name("A1")->buffer(), "first \nsecond \nthird \n", "Hidden statements via ###l4p"); + +done_testing; diff --git a/t/050Buffer.t b/t/050Buffer.t index c4ecd13b..0b490414 100644 --- a/t/050Buffer.t +++ b/t/050Buffer.t @@ -10,12 +10,11 @@ BEGIN { } } -use warnings; use strict; +use warnings; -use Test::More tests => 6; +use Test::More; use Log::Log4perl::Appender::TestBuffer; - use Log::Log4perl qw(:easy); my $conf = q( @@ -74,3 +73,5 @@ is($buf2->buffer(), "", "Buffering INFO"); $logger->error("This message triggers a buffer flush."); like($buf2->buffer(), qr/DEBUG.*?INFO.*?ERROR/s, "Flushing ERROR"); + +done_testing; diff --git a/t/051Extra.t b/t/051Extra.t index b8f3af0f..baeacd15 100644 --- a/t/051Extra.t +++ b/t/051Extra.t @@ -10,9 +10,8 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Log::Log4perl qw(:easy :no_extra_logdie_message); use Test::More; use File::Spec; @@ -22,8 +21,6 @@ use Log4perlInternalTest qw(tmpdir); BEGIN { if ($] < 5.008) { plan skip_all => "Only with perl >= 5.008"; - } else { - plan tests => 11; } } @@ -107,3 +104,5 @@ eval { $line_ref += 8; like($@, qr/logdie.*$line_ref/, "Output to stderr"); like($buf->buffer(), qr/logdie/, "Appender output intact"); + +done_testing; diff --git a/t/052Utf8.t b/t/052Utf8.t index 8720edeb..119eb326 100644 --- a/t/052Utf8.t +++ b/t/052Utf8.t @@ -25,8 +25,6 @@ use Log4perlInternalTest qw(tmpdir); BEGIN { if($] < 5.008) { plan skip_all => "utf-8 tests with perl >= 5.8 only"; - } else { - plan tests => 8; } } @@ -162,4 +160,6 @@ eval { DEBUG ""; }; -is $@, "", "zero bytes syswrite [rt.cpan.org #121346]" +is $@, "", "zero bytes syswrite [rt.cpan.org #121346]"; + +done_testing; diff --git a/t/053Resurrect.t b/t/053Resurrect.t index 5c211329..235dfd64 100644 --- a/t/053Resurrect.t +++ b/t/053Resurrect.t @@ -23,8 +23,6 @@ BEGIN { use Log::Log4perl::Resurrector; use L4pResurrectable; -plan tests => 1; - Log::Log4perl->init(\ <<'EOT'); log4perl.logger = DEBUG, A1 log4perl.appender.A1 = Log::Log4perl::Appender::TestBuffer @@ -36,3 +34,5 @@ my $buffer = Log::Log4perl::Appender::TestBuffer->by_name("A1"); L4pResurrectable::foo(); is($buffer->buffer(), "DEBUG - foo was here\nINFO - bar was here\n", "resurrected statement"); + +done_testing; diff --git a/t/054Subclass.t b/t/054Subclass.t index 0772d998..c246fd4d 100644 --- a/t/054Subclass.t +++ b/t/054Subclass.t @@ -23,7 +23,7 @@ use strict; use Test::More; -plan tests => 1; - my $logger = Mylogger->get_logger("Waah"); is($logger->{category}, "Waah", "subclass category rt #32942"); + +done_testing; diff --git a/t/055AppDestroy.t b/t/055AppDestroy.t index 3b73c9e3..d4b5f473 100644 --- a/t/055AppDestroy.t +++ b/t/055AppDestroy.t @@ -41,13 +41,13 @@ log4perl.appender.SomeA.layout = Log::Log4perl::Layout::SimpleLayout Log::Log4perl->init(\$conf); -plan tests => 1; - my $logger = get_logger(); $logger->debug("foo"); Log::Log4perl::Logger->cleanup(); END { - like $warnings, qr/Horrible Warning!/, "app destruction warning caught"; + ok 1; # under Devel::Cover, $warnings can end up undef + like $warnings, qr/Horrible Warning!/, "app destruction warning caught" if defined $warnings; + done_testing; } diff --git a/t/056SyncApp2.t b/t/056SyncApp2.t index 6c0841c0..f1ee6a42 100644 --- a/t/056SyncApp2.t +++ b/t/056SyncApp2.t @@ -25,9 +25,7 @@ our $INTERNAL_DEBUG = 0; $| = 1; BEGIN { - if(exists $ENV{"L4P_ALL_TESTS"}) { - plan tests => 1; - } else { + if(!exists $ENV{"L4P_ALL_TESTS"}) { plan skip_all => "- only with L4P_ALL_TESTS"; } } @@ -86,3 +84,4 @@ unlink $logfile; Log::Log4perl->appender_by_name('Syncer')->DESTROY(); ok(!$@, "Destroying appender"); +done_testing; diff --git a/t/057MsgChomp.t b/t/057MsgChomp.t index b3c047bf..ac389c84 100644 --- a/t/057MsgChomp.t +++ b/t/057MsgChomp.t @@ -10,12 +10,9 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; -BEGIN { plan tests => 4 }; - use Log::Log4perl qw(:easy); ######################################################### @@ -86,3 +83,5 @@ $buf = Log::Log4perl::Appender::TestBuffer->by_name("Buffer"); DEBUG "blah\n"; DEBUG "blah\n"; like($buf->buffer(), qr/blah foo /); + +done_testing; diff --git a/t/058Warnings.t b/t/058Warnings.t index 4dbb4645..febd8638 100644 --- a/t/058Warnings.t +++ b/t/058Warnings.t @@ -8,9 +8,6 @@ BEGIN { use Test::More; use Log::Log4perl qw(:nostrict); - -plan tests => 1; - my $warnings; $SIG{__WARN__} = sub { @@ -23,3 +20,5 @@ $EG_DIR = "../eg" unless -d $EG_DIR; Log::Log4perl->init( "$EG_DIR/dupe-warning.conf" ); is($warnings, undef, "no warnings"); + +done_testing; diff --git a/t/059Wrapper.t b/t/059Wrapper.t index 9c342395..693ffe7e 100644 --- a/t/059Wrapper.t +++ b/t/059Wrapper.t @@ -1,4 +1,7 @@ -#!/usr/local/bin/perl -w +############################################ +# Tests for Log4perl used by a wrapper class +# Mike Schilli, 2009 (m@perlmeister.com) +########################################### BEGIN { if($ENV{INTERNAL_DEBUG}) { @@ -8,19 +11,10 @@ BEGIN { } use strict; -use Log::Log4perl qw(:easy); - -############################################ -# Tests for Log4perl used by a wrapper class -# Mike Schilli, 2009 (m@perlmeister.com) -########################################### use warnings; -use strict; - +use Log::Log4perl qw(:easy); use Test::More; -BEGIN { plan tests => 12 } - ########################################### package L4p::RelayWrapper; ########################################### @@ -92,3 +86,5 @@ for my $class (qw(Log::Log4perl # use Data::Dumper; # print Dumper($logger; + +done_testing; diff --git a/t/060Initialized.t b/t/060Initialized.t index 5a13e5e0..59b69ff0 100644 --- a/t/060Initialized.t +++ b/t/060Initialized.t @@ -5,11 +5,9 @@ BEGIN { } } -use warnings; use strict; - -use Test::More tests => 3; - +use warnings; +use Test::More; use Log::Log4perl; use Log::Log4perl::Appender::TestBuffer; @@ -41,4 +39,4 @@ EOT ok(Log::Log4perl->initialized(), 'init flags initialized'); -1; # End of 060Initialized.t +done_testing; diff --git a/t/061Multiline.t b/t/061Multiline.t index 4d92460d..84b05d30 100644 --- a/t/061Multiline.t +++ b/t/061Multiline.t @@ -1,4 +1,3 @@ - # https://rt.cpan.org/Public/Bug/Display.html?id=60197 use Log::Log4perl; @@ -6,7 +5,7 @@ use Log::Log4perl::Appender; use Log::Log4perl::Appender::File; use Log::Log4perl::Layout::PatternLayout::Multiline; -use Test::More tests => 1; +use Test::More; my $logger = Log::Log4perl->get_logger("blah"); @@ -33,3 +32,5 @@ $appender->log({ level => 1, message => "\n\n" }, 'foo_category', 'INFO'); ok(1, "no warnings should appear here"); unlink $logfile; + +done_testing; diff --git a/t/062InitHash.t b/t/062InitHash.t index 07996c3d..5783554f 100644 --- a/t/062InitHash.t +++ b/t/062InitHash.t @@ -1,4 +1,3 @@ - # https://rt.cpan.org/Public/Bug/Display.html?id=68105 my $logfile = "test.log"; @@ -8,7 +7,7 @@ use Log::Log4perl; use Log::Log4perl::Appender; use Log::Log4perl::Appender::File; -use Test::More tests => 1; +use Test::More; Log::Log4perl->init({ 'log4perl.rootLogger' => 'ALL, FILE', @@ -25,3 +24,5 @@ my $data = join '', ; close FILE; is( $data, "DEBUG - yee haw\n", "hash-init with subref" ); + +done_testing; diff --git a/t/063LoggerRemove.t b/t/063LoggerRemove.t index 508f08a4..ce1d9da1 100644 --- a/t/063LoggerRemove.t +++ b/t/063LoggerRemove.t @@ -5,8 +5,6 @@ use strict; use Test::More; use Log::Log4perl::Appender::TestBuffer; -plan tests => 6; - use Log::Log4perl qw(get_logger :easy); # $Log::Log4perl::CHATTY_DESTROY_METHODS = 1; @@ -54,3 +52,5 @@ WARN "after"; like($buffer->buffer, qr/before/, "log message before logger removal present"); unlike($buffer->buffer, qr/after/, "log message after logger removal absent"); + +done_testing; diff --git a/t/064RealClass.t b/t/064RealClass.t index 8a53782b..4fdbd85c 100644 --- a/t/064RealClass.t +++ b/t/064RealClass.t @@ -5,8 +5,6 @@ use strict; use Test::More; use Log::Log4perl::Appender::TestBuffer; -plan tests => 1; - package AppBaseClass; use Log::Log4perl qw(get_logger :easy); sub meth { @@ -42,3 +40,5 @@ my $sub = AppSubClass->new(); $sub->meth(); is $buffer->buffer(), "in base class\n", "subclass logger in base class"; + +done_testing; diff --git a/t/065Undef.t b/t/065Undef.t index 31447e50..96442d03 100644 --- a/t/065Undef.t +++ b/t/065Undef.t @@ -1,6 +1,7 @@ use strict; - use File::Temp qw( tempfile ); +use Test::More; +use Log::Log4perl qw( :easy ); BEGIN { if($ENV{INTERNAL_DEBUG}) { @@ -11,10 +12,6 @@ BEGIN { my($tmpfh, $tempfile) = tempfile( UNLINK => 1 ); -use Test::More; -BEGIN { plan tests => 1 }; -use Log::Log4perl qw( :easy ); - Log::Log4perl->easy_init( { level => $DEBUG, file => $tempfile } ); my $warnings = ""; @@ -26,3 +23,5 @@ $SIG{__WARN__} = sub { DEBUG "foo", undef, "bar"; like $warnings, qr/Log message argument #2/, "warning for undef element issued"; + +done_testing; diff --git a/t/066SQLite.t b/t/066SQLite.t index 843e5701..0e3e9510 100644 --- a/t/066SQLite.t +++ b/t/066SQLite.t @@ -21,7 +21,6 @@ use Log4perlInternalTest qw(tmpdir min_version); BEGIN { min_version(qw( DBI DBD::SQLite )); - plan tests => 1; } my $testdir = tmpdir(); @@ -73,3 +72,5 @@ is_deeply $ary_ref->[0], ["WARN", "test message", undef], "data logged in db"; $Log::Log4perl::Config::CONFIG_INTEGRITY_CHECK = 0; # to close handles and allow temp files to go Log::Log4perl::init(\''); + +done_testing; diff --git a/t/067Exception.t b/t/067Exception.t index fba32353..30a7cf77 100644 --- a/t/067Exception.t +++ b/t/067Exception.t @@ -1,11 +1,8 @@ use strict; - use File::Temp qw( tempfile ); use Log::Log4perl qw( get_logger ); use Test::More; -plan tests => 1; - BEGIN { if($ENV{INTERNAL_DEBUG}) { require Log::Log4perl::InternalDebug; @@ -18,6 +15,7 @@ eval { }; like $@, qr/main::foo/, "stacktrace on internal error"; +done_testing; sub foo { Log::Log4perl::Logger->cleanup(); diff --git a/t/068MultilineIndented.t b/t/068MultilineIndented.t index 275ce985..600c90ed 100644 --- a/t/068MultilineIndented.t +++ b/t/068MultilineIndented.t @@ -6,7 +6,7 @@ use Log::Log4perl::Appender; use Log::Log4perl::Appender::File; use Log::Log4perl::Layout::PatternLayout; -use Test::More tests => 1; +use Test::More; my $logger = Log::Log4perl->get_logger("blah"); @@ -47,6 +47,8 @@ my $err_str = check_log_file_format($logfile); my $test_name = 'log file has multiline intended format' . ($err_str ? " - reason : $err_str" : ""); ok ( ! $err_str, $test_name ); +done_testing; + # returns "" on success # returns non empty error string on failure sub check_log_file_format { diff --git a/t/069MoreMultiline.t b/t/069MoreMultiline.t index 42d05b6d..9f4c0cf5 100644 --- a/t/069MoreMultiline.t +++ b/t/069MoreMultiline.t @@ -8,8 +8,7 @@ use Log::Log4perl; use Log::Log4perl::Appender; use Log::Log4perl::Appender::TestBuffer; use Log::Log4perl::Layout::PatternLayout; - -use Test::More tests => 4; +use Test::More; my $logger = Log::Log4perl->get_logger("blah"); @@ -52,3 +51,5 @@ $logit->(); #print "[", $appender->buffer(), "]\n"; is $appender->buffer(), "123line1\n line2\n line3", "indent,chomp"; $appender->buffer(""); + +done_testing; diff --git a/t/070UTCDate.t b/t/070UTCDate.t index 47072995..b2927877 100644 --- a/t/070UTCDate.t +++ b/t/070UTCDate.t @@ -9,13 +9,9 @@ BEGIN { } } -use warnings; use strict; - +use warnings; use Test::More; - -BEGIN { plan tests => 2 } - use Log::Log4perl qw(get_logger); use Log::Log4perl::Appender::TestBuffer; @@ -40,3 +36,5 @@ ok $Log::Log4perl::DateFormat::GMTIME, "init_with_utc"; init_with_utc(0); ok ! $Log::Log4perl::DateFormat::GMTIME, "init_with_utc"; + +done_testing;