/[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 573 by dpavlin, Mon Jul 3 14:30:22 2006 UTC revision 574 by dpavlin, Mon Jul 3 21:08:07 2006 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 112;  use Test::More tests => 140;
6  use Test::Exception;  use Test::Exception;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8  use blib;  use blib;
# Line 360  sub test_s { Line 360  sub test_s {
360          #          #
361          # MARC          # MARC
362          #          #
363            _debug( 4 );
364    
365          test_s(qq{ marc_indicators('900',1,2) });          test_s(qq{ marc_indicators('900',1,2) });
366          test_s(qq{ marc('900','a', rec('200') ) });          test_s(qq{ marc('900','a', rec('200') ) });
# Line 545  sub test_s { Line 546  sub test_s {
546          diag "leader: ", dump(marc_leader()) if ($debug);          diag "leader: ", dump(marc_leader()) if ($debug);
547          is_deeply(marc_leader(), { '06' => 42, 11 => 5 }, "marc_leader full");          is_deeply(marc_leader(), { '06' => 42, 11 => 5 }, "marc_leader full");
548    
         _debug(2);  
549          test_rule(          test_rule(
550                  'rec1(000)',                  'rec1(000)',
551                  { '000' => [ 42 ]},                  { '000' => [ 42 ]},
# Line 554  sub test_s { Line 554  sub test_s {
554          );          );
555    
556          test_rec_rules(          test_rec_rules(
557                  'marc_compose+split_rec_on',                  'marc(001,rec(000))',
558                  { '000' => [ 42 ]},                  { '000' => [ 42 ]},
559                  qq{                  qq{
560                          marc('001', rec('000') );                          marc('001', rec('000') );
561                  },                  },
562                  [                  [
563                          [ '001', ' ', ' ', 42, ]                          [ '001', 42, ]
564                    ],
565            );
566    
567            test_rec_rules(
568                    'marc_remove',
569                    { '200' => [{ a => 42, b => 'bar', c => 'baz' }] },
570                    qq{
571                            marc('900', 'a', rec('200','a') );
572                            marc('900', 'b', rec('200','b') );
573                            marc_remove('900','b');
574                            marc('900', 'b', rec('200','c') );
575                            marc_remove('900','a');
576                    },
577                    [
578                            [ '900', ' ', ' ', 'b', 'baz' ],
579                    ],
580            );
581    
582            test_rec_rules(
583                    'marc_duplicate',
584                    { '200' => [{ a => 42, b => 'bar', c => 'baz', d => 'bing', e => 'bong' }] },
585                    qq{
586                            marc('900', 'a', rec('200','a') );
587                            marc('900', 'b', rec('200','b') );
588                            marc_duplicate;
589                            marc_remove('900','b');
590                            marc('900', 'b', rec('200','c') );
591                            marc_duplicate;
592                            marc_remove('900','b');
593                            marc('900', 'b', rec('200','d') );
594                            marc_duplicate;
595                            marc_remove('900','b');
596                            marc('900', 'b', rec('200','e') );
597                    },
598                    [
599                            # this will return FIRST record
600                            [ '900', ' ', ' ', 'a', 42, 'b', 'bar' ],
601                  ],                  ],
602          );          );
603    
604            my $i = 0;
605            foreach my $v ( qw/bar baz bing bong/ ) {
606    
607                    ok(@marc = WebPAC::Normalize::_get_marc_fields( offset => $i ),
608                            "_get_marc_fields( offset => $i )"
609                    );
610                    diag "marc $i = ", dump( @marc ) if ($debug);
611                    is_deeply( \@marc,
612                            [ [ '900', ' ', ' ', 'a', 42, 'b', $v ] ],
613                            "MARC copy $i has $v",
614                    );
615                    $i++;
616            }
617  }  }
618    

Legend:
Removed from v.573  
changed lines
  Added in v.574

  ViewVC Help
Powered by ViewVC 1.1.26