Test-Log4perl

 view release on metacpan or  search on metacpan

t/01basic.t  view on Meta::CPAN

$tlogger->error("my hair is on fire!");
$logger->warn("my hair is on fire!");
Test::Log4perl->end();

test_test("getting wrong priority");

########################################################

test_out("not ok 1 - Log4perl test");
test_fail(+9);
test_diag("1st message logged wasn't what we expected:");
test_diag(" category was 'Foo'");
test_diag("          not 'Bar'");
test_diag(" (Offending log call from line ".(__LINE__+4)." in ".filename().")");

Test::Log4perl->start();
$t2logger->error("my hair is on fire!");
$logger->error("my hair is on fire!");
Test::Log4perl->end();

test_test("getting wrong category");

########################################################

test_out("not ok 1 - Log4perl test");
test_fail(+13);
test_diag("1st message logged wasn't what we expected:");
test_diag(" category was 'Foo'");
test_diag("          not 'Bar'");
test_diag(" priority was 'warn'");
test_diag("          not 'error'");
test_diag("  message was 'your hair is on fire!'");
test_diag("          not 'my hair is on fire!'");
test_diag(" (Offending log call from line ".(__LINE__+4)." in ".filename().")");

Test::Log4perl->start();
$t2logger->error("my hair is on fire!");
$logger->warn("your hair is on fire!");
Test::Log4perl->end();

test_test("getting it all wrong");

########################################################

Test::Log4perl->start();
$tlogger->fatal("my hair is on fire!");

throws_ok {
 $logger->logdie("my hair is on fire!");
} qr/my hair is on fire!/, "logdie dies";

test_out("ok 1 - Log4perl test");
Test::Log4perl->end();
test_test("logdie");

##################################
##################################

sub filename
{
  return (caller)[1];
}



( run in 1.995 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )