Akron | 84b53ad | 2022-01-14 12:39:15 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use Data::Dumper; |
| 5 | use Test::More; |
| 6 | use File::Temp 'tempfile'; |
| 7 | use File::Basename 'dirname'; |
| 8 | use File::Spec::Functions qw!catdir catfile!; |
| 9 | |
| 10 | use_ok('KorAP::XML::Log::Slim'); |
| 11 | |
| 12 | my $temp = tempfile(); |
| 13 | |
| 14 | my $file = catfile(dirname(__FILE__), 'logs','dereko-example-log.txt'); |
| 15 | |
| 16 | ok(!KorAP::XML::Log::Slim->new); |
| 17 | |
| 18 | my $slim = KorAP::XML::Log::Slim->new($file); |
| 19 | |
| 20 | $slim->slim_to($temp); |
| 21 | |
| 22 | seek($temp, 0,0); |
| 23 | |
| 24 | my $content; |
| 25 | { |
| 26 | local $/; |
| 27 | $content = <$temp>; |
| 28 | } |
| 29 | |
| 30 | like($content, qr!2 Start serial processing of e03\.\*zip!); |
| 31 | unlike($content, qr!Convert \[[^:]+?\:2\/\d+?\] Processed!); |
| 32 | unlike($content, qr!Unable to process!); |
| 33 | like($content, qr!Use of uninitialized value!); |
| 34 | like($content, qr!End-of-central-directory!); |
| 35 | like($content, qr!## Done\. \[\!Process\: 1\]!); |
| 36 | like($content, qr!file #1: bad zipfile offset!); |
| 37 | like($content, qr!cannot find zipfile directory!); |
| 38 | |
| 39 | done_testing; |