File: rfc3339.t

package info (click to toggle)
libparse-syslog-perl 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 252 kB
  • sloc: perl: 333; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 996 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use Test;
use POSIX;
use lib "lib";
BEGIN { plan tests => 41 };
use Parse::Syslog;
ok(1); # If we made it this far, we're ok.

#########################
$ENV{TZ} = 'CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00';
POSIX::tzset();

my $parser = Parse::Syslog->new("t/linux-rfc3339syslog");
open(PARSED, "<t/linux-parsed") or die "can't open t/linux-parsed: $!\n";
while(my $sl = $parser->next) {
        my $is = '';
        $is .= "time    : ".(gmtime($sl->{timestamp}))."\n";
        $is .= "host    : $sl->{host}\n";
        $is .= "program : $sl->{program}\n";
        $is .= "pid     : ".(defined $sl->{pid} ? $sl->{pid} : 'undef')."\n";
        $is .= "text    : $sl->{text}\n";
        $is .= "\n";
        print "$is";

        my $shouldbe = '';
        $shouldbe .= <PARSED>;
        $shouldbe .= <PARSED>;
        $shouldbe .= <PARSED>;
        $shouldbe .= <PARSED>;
        $shouldbe .= <PARSED>;
        $shouldbe .= <PARSED>;

        ok($is, $shouldbe);
}

# vim: set filetype=perl: