$ cvs diff 35recognition.t
Index: 35recognition.t
===================================================================
RCS file: /cvs/locust/locust/t/35recognition.t,v
retrieving revision 1.5
diff -r1.5 35recognition.t
7c7
< use Test::More tests => 13;
---
> use Test::More tests => 15;
124a125,178
>
>
> # Test de la lecture de fichier crées par syslog
> # Cela implique qu'un certain nombre de champs sont manquants : facility,
level
> # La difficulté est augmentée par le fait que d'autres champs sont
optionnels,
> # et plus des hacks (répandus, certes) au format syslog BSD que
véritablement
> # normalisés : program, pid (souvent accolé attaché à program mais
optionnel
> # même si program est là).
> cleanup();
>
> #my ( $log, $rec, $input );
> $rec = Locust::Recognition->new;
> $input = Locust::Input->new(
> file => 't/file04.log',
> match => qr/^(\w\w\w\s+\d+ \d\d:\d\d:\d\d) (\S*) (?:(\S*):)? (.*)$/,
> fields => [ qw( date host program message ) ],
> datefmt => "%b %e %H:%M:%S",
> );
>
> $log = $input->next;
> is_deeply( $log,
> {
> 'HOST' => 'mars',
> 'DATE' => 'Jul 5 23:18:11',
> 'FACILITY' => undef,
> 'ORIG' => 'Jul 5 23:18:11 mars -- MARK --
> ',
> 'LEVEL' => undef,
> 'MESSAGE' => '-- MARK --',
> 'PROGRAM' => undef,
> 'EPOCH' => 1089062291,
> 'PID' => undef,
> 'SOURCE' => 't/file04.log'
> },
> "Got the correct log"
> );
>
> $rec->recognize( $log );
> is_deeply( $log,
> {
> 'HOST' => 'mars',
> 'DATE' => 'Jul 5 23:18:11',
> 'FACILITY' => undef,
> 'ORIG' => 'Jul 5 23:19:39 neptune -- MARK --
> ',
> 'LEVEL' => undef,
> 'MESSAGE' => '-- MARK --',
> 'PROGRAM' => undef,
> 'EPOCH' => 1089062379,
> 'PID' => undef,
> 'SOURCE' => 't/file04.log'
> },
> "Got the correct log"
> );
--
Jérôme Fenal - Consultant Unix/SAN/Logiciel Libre
Groupe Expert & Managed Services - LogicaCMG France
http://www.logicacmg.com/fr/ - <mailto:jerome.fenal AT logicacmg.com>
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.