[libmoox-role-logger-perl] 06/08: add a simple test

Jonas Smedegaard dr at jones.dk
Mon Mar 23 20:24:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag release-0.001
in repository libmoox-role-logger-perl.

commit 219518a93ab00e899ec74c06bd9eb2b1278c2030
Author: David Golden <dagolden at cpan.org>
Date:   Thu Oct 3 00:00:55 2013 -0400

    add a simple test
---
 lib/MooseX/Role/Logger.pm |  8 +++-----
 t/basic.t                 | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/lib/MooseX/Role/Logger.pm b/lib/MooseX/Role/Logger.pm
index 3329bc8..4f786da 100644
--- a/lib/MooseX/Role/Logger.pm
+++ b/lib/MooseX/Role/Logger.pm
@@ -7,7 +7,7 @@ package MooseX::Role::Logger;
 # VERSION
 
 use Moo::Role;
-use Types::Standard qw/InstanceOf Str/;
+use Types::Standard qw/Str/;
 
 use Log::Any ();
 
@@ -18,10 +18,8 @@ Returns a logging object.  See L<Log::Any> for a list of logging methods it acce
 =cut
 
 has logger => (
-    is => 'lazy',
-    # Log::Any::Proxy will be in next-gen Log::Any and replace Log::Any::Adapter::*
-    isa =>
-      InstanceOf [qw/Log::Any::Proxy Log::Any::Adapter::Base Log::Any::Adapter::Null/],
+    is       => 'lazy',
+    isa      => sub { ref( $_[0] ) =~ /^Log::Any/ }, # XXX too many options
     init_arg => undef,
 );
 
diff --git a/t/basic.t b/t/basic.t
new file mode 100644
index 0000000..89d9e1f
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,25 @@
+use 5.008001;
+use strict;
+use warnings;
+use Test::More 0.96;
+use Test::FailWarnings;
+
+use Log::Any::Test;
+use Log::Any qw/$log/;
+
+use lib 'example';
+
+use MyModule;
+
+my $obj = new_ok('MyModule');
+
+my $log_class = ref $obj->logger;
+like( $log_class, qr/^Log::Any/, "logger came is from Log::Any" );
+
+$obj->cry;
+
+$log->contains_ok( qr/I'm sad/, "got log message" );
+
+done_testing;
+# COPYRIGHT
+# vim: ts=4 sts=4 sw=4 et:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoox-role-logger-perl.git



More information about the Pkg-perl-cvs-commits mailing list