X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=t%2FApp-Lastmsg.t;h=b8ad563ee4567a01f8ecae202df600e7fe30468a;hb=8dffa80bd13da3bedacff245a20f896ee9ceb602;hp=a5eca2977adcb7482101671212b9908319279380;hpb=82af6c123c3cc37d8c4174dbb7e5180e067fd7dd;p=app-lastmsg.git diff --git a/t/App-Lastmsg.t b/t/App-Lastmsg.t index a5eca29..b8ad563 100644 --- a/t/App-Lastmsg.t +++ b/t/App-Lastmsg.t @@ -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'; - *POSIX::strftime = sub { - my ($format, @rest) = @_; - $real_strftime->('%s', @rest) - }; + *App::Lastmsg::format_time = sub { shift }; } chdir 't'; @@ -23,7 +18,22 @@ $0 = 'lastmsg'; App::Lastmsg::run; is $out, <<'EOF', 'output is correct'; -user2 user2@example.org Sat 31 Dec 2016 13:10:00 EET -user1 user1@example.com Fri 30 Dec 2016 15:44:00 EET +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 from User 1 (Comment) +Processing from user1@example.com +Processing from user2@example.com +Scanning sent (sent) +Processing <33r32r32igf432g@localhost.localdomain> sent to Random User (Very random), User 2 +EOF