Commits

Fabrice Gabolde committed 73bf4aa

Removed tests on abstract class.

Comments (0)

Files changed (1)

t/logger-default.t

-#!perl
-
-use strict;
-use warnings;
-use 5.010;
-use Carp;
-
-use Test::More;
-use File::Temp;
-use File::Spec;
-use Plack::Request;
-
-use_ok 'Floop::Logger';
-
-my $tempdir = File::Temp->newdir;
-
-my $access_log = File::Spec->catfile($tempdir->dirname, 'access.log');
-my $error_log = File::Spec->catfile($tempdir->dirname, 'error.log');
-
-my $logger = new_ok('Floop::Logger', [ access_log_path => $access_log,
-                                       error_log_path => $error_log,
-                                       log_level => 6 ]);
-
-$logger->core('hi there');
-$logger->debug('foo');
-$logger->info('bar');
-$logger->warning('baz');
-$logger->error('quux');
-$logger->fatal('xyzzy');
-
-open my $error_fh, '<', $error_log
-    or BAIL_OUT("cannot open '$error_log' for reading: $!");
-
-chomp(my $line = $error_fh->getline);
-like($line, qr/^CORE - .+ - hi there$/);
-
-chomp($line = $error_fh->getline);
-like($line, qr/^DEBUG - .+ - foo$/);
-
-chomp($line = $error_fh->getline);
-like($line, qr/^INFO - .+ - bar$/);
-
-chomp($line = $error_fh->getline);
-like($line, qr/^WARN - .+ - baz$/);
-
-chomp($line = $error_fh->getline);
-like($line, qr/^ERROR - .+ - quux$/);
-
-chomp($line = $error_fh->getline);
-like($line, qr/^FATAL - .+ - xyzzy$/);
-
-$error_fh->close;
-
-open my $access_fh, '<', $access_log
-    or BAIL_OUT("cannot open '$access_log' for reading: $!");
-
-# barebones env
-$logger->log_access(Plack::Request->new({ HTTP_USER_AGENT => 'foobar (compatible) baz, like Gecko',
-                                          REQUEST_METHOD => 'POUPOUTTE',
-                                          PATH_INFO => '/xyzzy',
-                                          REMOTE_ADDR => '1.2.3.4' }));
-
-chomp($line = $access_fh->getline);
-like($line, qr{^ACCESS - .+ - "1.2.3.4" "POUPOUTTE /xyzzy" "foobar \(compatible\) baz, like Gecko"$});
-
-$access_fh->close;
-
-done_testing;