#!/usr/bin/perl -w
use strict;
-use Test::More tests => 51;
-use Test::Exception;
use blib;
-use Data::Dump qw/dump/;
-use Cwd qw/abs_path/;
+use Test::More tests => 55;
+
use YAML qw/LoadFile/;
BEGIN {
+use_ok( 'WebPAC::Test' );
use_ok( 'WebPAC::Parser' );
use_ok( 'WebPAC::Config' );
}
-my $debug = shift @ARGV;
-
-ok(my $abs_path = abs_path($0), "abs_path");
-$abs_path =~ s#/[^/]*$#/#;
-
my $config_path = "$abs_path/conf/test.yml";
ok(-e $config_path, "$config_path exists");
-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";
ok(
my $parser = new WebPAC::Parser(
config => new WebPAC::Config( path => $config_path ),
base_path => $abs_path,
- debug => $debug,
+ %LOG
), "new");
my $inputs = {
}
}
+$config_path = "$abs_path/conf/marc.yml";
+
+ok(-e $config_path, "$config_path exists");
+
+ok(
+ my $parser = new WebPAC::Parser(
+ config => new WebPAC::Config( path => $config_path ),
+ base_path => $abs_path,
+ %LOG,
+), "new");
+
+ok(my $marc = $parser->have_rules('marc', 'marc', 'marc-input'), 'have_rules(marc,...)');
+
+diag "marc: ",dump($marc) if ($debug);
+
+is_deeply($marc, {
+ marc => 1,
+ marc_compose => 1,
+ marc_duplicate => 1,
+ marc_indicators => 1,
+ marc_leader => 1,
+ marc_original_order => 1,
+ marc_remove => 1,
+ marc_repeatable_subfield => 1,
+}, 'catched all marc_*');
+