"Fossies" - the Fresh Open Source Software Archive

Member "Parse-Syslog-1.10/t/misc.t" (30 Sep 2007, 803 Bytes) of package /linux/privat/old/Parse-Syslog-1.10.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 use Test;
    2 use lib "lib";
    3 BEGIN { plan tests => 4 };
    4 use Parse::Syslog;
    5 ok(1); # If we made it this far, we're ok.
    6 
    7 #########################
    8 
    9 my $parser = Parse::Syslog->new("t/misc-syslog", year=>2002);
   10 open(PARSED, "<t/misc-parsed") or die "can't open t/misc-parsed: $!\n";
   11 while(my $sl = $parser->next) {
   12 	my $is = '';
   13 	$is .= "time    : ".(localtime($sl->{timestamp}))."\n";
   14 	$is .= "host    : $sl->{host}\n";
   15 	$is .= "program : $sl->{program}\n";
   16 	$is .= "pid     : ".(defined $sl->{pid} ? $sl->{pid} : 'undef')."\n";
   17 	$is .= "text    : $sl->{text}\n";
   18 	$is .= "\n";
   19 	print "$is";
   20 
   21 	my $shouldbe = '';
   22 	$shouldbe .= <PARSED>;
   23 	$shouldbe .= <PARSED>;
   24 	$shouldbe .= <PARSED>;
   25 	$shouldbe .= <PARSED>;
   26 	$shouldbe .= <PARSED>;
   27 	$shouldbe .= <PARSED>;
   28 	
   29 	ok($is, $shouldbe);
   30 }
   31 
   32 # vim: set filetype=perl: