/[webpac2]/trunk/t/3-normalize.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/3-normalize.t

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

revision 791 by dpavlin, Tue Jan 30 18:21:17 2007 UTC revision 813 by dpavlin, Sun Apr 1 21:47:47 2007 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 322;  use Test::More tests => 332;
6  use Test::Exception;  use Test::Exception;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8  use blib;  use blib;
# Line 207  sub test_s { Line 207  sub test_s {
207    
208          ok(_set_load_row(sub {          ok(_set_load_row(sub {
209                  my ($database,$input,$mfn) = @_;                  my ($database,$input,$mfn) = @_;
210                  diag "load_row( $database, $input, $mfn )";                  diag "load_row( $database, $input, $mfn )" if ($debug);
211                  cmp_ok( $#_, '==', 2, 'have 3 arguments');                  cmp_ok( $#_, '==', 2, 'have 3 arguments');
212                  ok($database, '_load_row database');                  ok($database, '_load_row database');
213                  ok($input, '_load_row input');                  ok($input, '_load_row input');
# Line 236  sub test_s { Line 236  sub test_s {
236                  );                  );
237    
238                  ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup');                  ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup');
239                  diag "_get_lookup = ", dump($l);                  diag "_get_lookup = ", dump($l) if ($debug);
240    
241                  my @lookup;                  my @lookup;
242    
243                  ok(@lookup = lookup(                  ok(@lookup = lookup(
244                                  sub {                                  sub {
245                                          diag "in show";                                          diag "in show" if ($debug);
246                                          rec('900','x');                                          rec('900','x');
247                                  },                                  },
248                                  'db','input','key',                                  'db','input','key',
# Line 261  sub test_s { Line 261  sub test_s {
261          }          }
262    
263          ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup');          ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup');
264          diag "_get_lookup = ", dump($l);          diag "_get_lookup = ", dump($l) if ($debug);
265    
266          is_deeply( $l, {          is_deeply( $l, {
267                  db => {                  db => {
# Line 281  sub test_s { Line 281  sub test_s {
281    
282  #######  #######
283    
284          diag "lookup_hash1 = ", dump($lookup_hash1);          diag "lookup_hash1 = ", dump($lookup_hash1) if ($debug);
285          ok(_set_lookup( $lookup_hash1 ), '_set_lookup $lookup_hash1');          ok(_set_lookup( $lookup_hash1 ), '_set_lookup $lookup_hash1');
286    
287          throws_ok { _set_load_row() } qr/CODE/, 'empty _set_load_row()';          throws_ok { _set_load_row() } qr/CODE/, 'empty _set_load_row()';
# Line 740  sub test_s { Line 740  sub test_s {
740                  'marc_duplicate',                  'marc_duplicate',
741                  { '200' => [{ a => 42, b => 'bar', c => 'baz', d => 'bing', e => 'bong' }] },                  { '200' => [{ a => 42, b => 'bar', c => 'baz', d => 'bing', e => 'bong' }] },
742                  qq{                  qq{
743                            marc_leader('06',42);
744                            marc_leader('11',0);
745                          marc('900', 'a', rec('200','a') );                          marc('900', 'a', rec('200','a') );
746                          marc('900', 'b', rec('200','b') );                          marc('900', 'b', rec('200','b') );
747                          marc_duplicate;                          marc_duplicate;
748                            marc_leader('11',1);
749                          marc_remove('900','b');                          marc_remove('900','b');
750                          marc('900', 'b', rec('200','c') );                          marc('900', 'b', rec('200','c') );
751                          marc_duplicate;                          marc_duplicate;
752                            marc_leader('11',2);
753                          marc_remove('900','b');                          marc_remove('900','b');
754                          marc('900', 'b', rec('200','d') );                          marc('900', 'b', rec('200','d') );
755                          marc_duplicate;                          marc_duplicate;
756                            marc_leader('11',3);
757                          marc_remove('900','b');                          marc_remove('900','b');
758                          marc('900', 'b', rec('200','e') );                          marc('900', 'b', rec('200','e') );
759                  },                  },
# Line 758  sub test_s { Line 763  sub test_s {
763                  ],                  ],
764          );          );
765    
766            cmp_ok( marc_count(), '==', 3, 'marc_count' );
767    
768          my $i = 0;          my $i = 0;
769          foreach my $v ( qw/bar baz bing bong/ ) {          foreach my $v ( qw/bar baz bing bong/ ) {
770    
# Line 769  sub test_s { Line 776  sub test_s {
776                          [ [ '900', ' ', ' ', 'a', 42, 'b', $v ] ],                          [ [ '900', ' ', ' ', 'a', 42, 'b', $v ] ],
777                          "MARC copy $i has $v",                          "MARC copy $i has $v",
778                  );                  );
779                    is_deeply(WebPAC::Normalize::_get_marc_leader(), { '06' => 42, 11 => $i }, "_get_marc_leader copy $i");
780                  $i++;                  $i++;
781          }          }
782    

Legend:
Removed from v.791  
changed lines
  Added in v.813

  ViewVC Help
Powered by ViewVC 1.1.26