]> iEval git - app-lastmsg.git/blobdiff - t/App-Lastmsg.t
Improve tests
[app-lastmsg.git] / t / App-Lastmsg.t
index 2439d3f1997e270331a71cce01ab374592ec380a..b8ad563ee4567a01f8ecae202df600e7fe30468a 100644 (file)
@@ -2,17 +2,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More tests => 3;
 BEGIN { use_ok('App::Lastmsg') };
 
-my $real_strftime = \&POSIX::strftime;
-
 {
        no warnings 'redefine';
-       *App::Lastmsg::strftime = sub {
-               my ($format, @rest) = @_;
-               $real_strftime->('%s', @rest)
-       };
+       *App::Lastmsg::format_time = sub { shift };
 }
 
 chdir 't';
@@ -27,3 +22,18 @@ user2 user2@example.org 1483182600
 user1 user1@example.com 1483105440
 user3                   NOT FOUND
 EOF
+
+$ENV{LASTMSG_DEBUG} = 1;
+my $err = '';
+close STDERR;
+open STDERR, '>', \$err or die "$!";
+App::Lastmsg::run;
+
+is $err, <<'EOF', 'debug output is correct';
+Scanning inbox (inbox)
+Processing <mail1@example.com> from User 1 <user1@example.com> (Comment)
+Processing <mail2@example.com> from user1@example.com
+Processing <mail3@example.com> from user2@example.com
+Scanning sent (sent)
+Processing <33r32r32igf432g@localhost.localdomain> sent to Random User <rando@example.com> (Very random), User 2 <user2@example.org>
+EOF
This page took 0.018561 seconds and 4 git commands to generate.