Skip to content
Browse files

more tests

  • Loading branch information...
1 parent b09cdab commit a2ae5055248ac2fd8dfc1c1118ba76c2315b53d4 @garu committed Dec 10, 2010
Showing with 36 additions and 0 deletions.
  1. +36 −0 t/01-standard.t
View
36 t/01-standard.t
@@ -0,0 +1,36 @@
+use Test::More tests => 26;
+
+# class tests
+can_ok('MojoX::Log::Log4perl', qw(new log));
+can_ok('MojoX::Log::Log4perl', qw(trace debug info warn error fatal));
+
+can_ok('MojoX::Log::Log4perl', qw(logwarn logdie error_warn error_die
+ logcarp logcluck logcroak logconfess)
+ );
+can_ok('MojoX::Log::Log4perl', qw(is_trace is_debug is_info is_warn
+ is_error is_fatal)
+ );
+can_ok('MojoX::Log::Log4perl', qw(level is_level));
+
+
+use MojoX::Log::Log4perl;
+my $logger = MojoX::Log::Log4perl->new;
+isa_ok($logger, 'MojoX::Log::Log4perl');
+
+ok (!$logger->is_trace, 'default mode is debug (is_trace check)');
+ok ($logger->is_debug, 'default mode is debug (is_debug check)');
+ok ($logger->is_info, 'default mode is debug (is_info check)');
+ok ($logger->is_warn, 'default mode is debug (is_warn check)');
+ok ($logger->is_error, 'default mode is debug (is_error check)');
+ok ($logger->is_fatal, 'default mode is debug (is_fatal check)');
+
+is ($logger->level, 'DEBUG', 'level() should be DEBUG');
+$logger->level('warn');
+is ($logger->level, 'WARN', 'level("warn") should change log level');
+
+$logger->level('OFF');
+foreach (qw(fatal error warn info debug trace)) {
+ ok (!$logger->is_level($_), "shouldn't be level $_");
+ $logger->level($_);
+ ok ($logger->is_level($_), "testing level '$_'");
+}

0 comments on commit a2ae505

Please sign in to comment.
Something went wrong with that request. Please try again.