/[webpac2]/trunk/t/2-parse.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/2-parse.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 706 by dpavlin, Mon Sep 25 14:06:49 2006 UTC revision 737 by dpavlin, Thu Oct 5 14:38:45 2006 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use strict;  use strict;
4  use Test::More tests => 43;  use Test::More tests => 55;
5  use Test::Exception;  use Test::Exception;
6  use blib;  use blib;
7    
# Line 54  ok($parser->{_lookup_create}, "_lookup_c Line 54  ok($parser->{_lookup_create}, "_lookup_c
54  diag "_lookup_create_key = ",dump($l) if ($debug);  diag "_lookup_create_key = ",dump($l) if ($debug);
55  foreach my $db (keys %$l) {  foreach my $db (keys %$l) {
56          foreach my $i (keys %{$l->{$db}}) {          foreach my $i (keys %{$l->{$db}}) {
57                  ok(defined($parser->lookup_create_rules($db,$i)), "have $db/$i");                  ok(defined($parser->lookup_create_rules($db,$i)), "lookup_create_rules($db/$i)");
58                  my @keys = sort keys %{$l->{$db}->{$i}};                  my @keys = sort keys %{$l->{$db}->{$i}};
59                  ok(@keys, 'have keys');                  ok(@keys, 'have keys');
60                  my @have_keys = sort $parser->have_lookup_create($db,$i);                  my @have_keys = sort $parser->have_lookup_create($db,$i);
# Line 65  foreach my $db (keys %$l) { Line 65  foreach my $db (keys %$l) {
65    
66  ok(my $n = $parser->{_normalize_source}, "_normalize_source");  ok(my $n = $parser->{_normalize_source}, "_normalize_source");
67  diag "_normalize_source = ",dump($n) if ($debug);  diag "_normalize_source = ",dump($n) if ($debug);
68    foreach my $db (keys %$n) {
69            foreach my $i (keys %{$n->{$db}}) {
70                    ok(my $r = $parser->normalize_rules($db,$i), "normalize_source($db/$i)");
71                    diag "normalize_rules($db,$i) = $r" if ($debug);
72                    cmp_ok($n->{$db}->{$i}, 'eq', $r, "same");
73            }
74    }
75    
76  ok(my $d = $parser->{depends}, "depends");  ok(my $d = $parser->{depends}, "depends");
77  diag "depends = ",dump($d) if ($debug);  diag "depends = ",dump($d) if ($debug);
# Line 105  foreach my $db (keys %$d) { Line 112  foreach my $db (keys %$d) {
112          }          }
113  }  }
114    
115    $config_path = "$abs_path/conf/marc.yml";
116    
117    ok(-e $config_path, "$config_path exists");
118    
119    ok(
120            my $parser = new WebPAC::Parser(
121                    config => new WebPAC::Config( path => $config_path ),
122                    base_path => $abs_path,
123                    debug => $debug,
124    ), "new");
125    
126    ok(my $marc = $parser->generate_marc('marc','marc-input'), 'generate_marc');
127    
128    diag "marc: ",dump($marc) if ($debug);
129    
130    is_deeply($marc, {
131            marc                                            => 1,
132            marc_compose                            => 1,
133            marc_duplicate                          => 1,
134            marc_indicators                         => 1,
135            marc_leader                                     => 1,
136            marc_original_order                     => 1,
137            marc_remove                                     => 1,
138            marc_repeatable_subfield        => 1,
139    }, 'catched all marc_*');
140    

Legend:
Removed from v.706  
changed lines
  Added in v.737

  ViewVC Help
Powered by ViewVC 1.1.26