1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use strict; |
use strict; |
|
use Test::More tests => 55; |
|
|
use Test::Exception; |
|
4 |
use blib; |
use blib; |
5 |
|
|
6 |
use Data::Dump qw/dump/; |
use Test::More tests => 55; |
7 |
use Cwd qw/abs_path/; |
|
8 |
use YAML qw/LoadFile/; |
use YAML qw/LoadFile/; |
9 |
|
|
10 |
BEGIN { |
BEGIN { |
11 |
|
use_ok( 'WebPAC::Test' ); |
12 |
use_ok( 'WebPAC::Parser' ); |
use_ok( 'WebPAC::Parser' ); |
13 |
use_ok( 'WebPAC::Config' ); |
use_ok( 'WebPAC::Config' ); |
14 |
} |
} |
15 |
|
|
|
my $debug = shift @ARGV; |
|
|
|
|
|
ok(my $abs_path = abs_path($0), "abs_path"); |
|
|
$abs_path =~ s#/[^/]*$#/#; |
|
|
|
|
16 |
my $config_path = "$abs_path/conf/test.yml"; |
my $config_path = "$abs_path/conf/test.yml"; |
17 |
|
|
18 |
ok(-e $config_path, "$config_path exists"); |
ok(-e $config_path, "$config_path exists"); |
19 |
|
|
20 |
throws_ok { new WebPAC::Parser( no_log => 1 ) } qr/WebPAC::Config/, "new without config"; |
throws_ok { new WebPAC::Parser( %LOG ) } qr/WebPAC::Config/, "new without config"; |
21 |
|
|
22 |
ok( |
ok( |
23 |
my $parser = new WebPAC::Parser( |
my $parser = new WebPAC::Parser( |
24 |
config => new WebPAC::Config( path => $config_path ), |
config => new WebPAC::Config( path => $config_path ), |
25 |
base_path => $abs_path, |
base_path => $abs_path, |
26 |
debug => $debug, |
%LOG |
27 |
), "new"); |
), "new"); |
28 |
|
|
29 |
my $inputs = { |
my $inputs = { |
114 |
my $parser = new WebPAC::Parser( |
my $parser = new WebPAC::Parser( |
115 |
config => new WebPAC::Config( path => $config_path ), |
config => new WebPAC::Config( path => $config_path ), |
116 |
base_path => $abs_path, |
base_path => $abs_path, |
117 |
debug => $debug, |
%LOG, |
118 |
), "new"); |
), "new"); |
119 |
|
|
120 |
ok(my $marc = $parser->have_rules('marc', 'marc', 'marc-input'), 'have_rules(marc,...)'); |
ok(my $marc = $parser->have_rules('marc', 'marc', 'marc-input'), 'have_rules(marc,...)'); |