LP#1824181: add test cases
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 7 Jun 2019 15:30:42 +0000 (11:30 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 7 Jun 2019 15:31:59 +0000 (11:31 -0400)
To test
-------
[1] Verify that 'make check' (or prove src/perl/t/09-Utils-Logger.t)
    passes.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

src/perl/t/09-Utils-Logger.t

index 9ad7708..69f04e2 100644 (file)
@@ -1,7 +1,16 @@
 #!perl -T
 
-use Test::More tests => 1;
+use Test::More tests => 3;
 
 BEGIN {
        use_ok( 'OpenSRF::Utils::Logger' );
 }
+
+my $msg = OpenSRF::Utils::Logger::_log_message('this is a message', OpenSRF::Utils::Logger::INFO());
+like($msg, qr/this is a message/, 'can use a string as a log message');
+
+$msg = OpenSRF::Utils::Logger::_log_message(
+    sub { return 'this is a message generated by a subroutine' },
+    OpenSRF::Utils::Logger::INFO()
+);
+like($msg, qr/generated by a subroutine/, 'can use a subroutine as a log message');