2439d3f1997e270331a71cce01ab374592ec380a
[app-lastmsg.git] / t / App-Lastmsg.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::More tests => 2;
6 BEGIN { use_ok('App::Lastmsg') };
7
8 my $real_strftime = \&POSIX::strftime;
9
10 {
11 no warnings 'redefine';
12 *App::Lastmsg::strftime = sub {
13 my ($format, @rest) = @_;
14 $real_strftime->('%s', @rest)
15 };
16 }
17
18 chdir 't';
19 my $out = '';
20 open my $fh, '>', \$out or die "$!";
21 $App::Lastmsg::OUTPUT_FILEHANDLE = $fh;
22 $0 = 'lastmsg';
23 App::Lastmsg::run;
24
25 is $out, <<'EOF', 'output is correct';
26 user2 user2@example.org 1483182600
27 user1 user1@example.com 1483105440
28 user3 NOT FOUND
29 EOF
This page took 0.024205 seconds and 3 git commands to generate.