/[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 550 by dpavlin, Fri Jun 30 18:48:33 2006 UTC revision 811 by dpavlin, Sun Apr 1 21:47:40 2007 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 81;  use Test::More tests => 322;
6  use Test::Exception;  use Test::Exception;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8  use blib;  use blib;
9  use File::Slurp;  use File::Slurp;
10    use Getopt::Long;
 use Data::Dump qw/dump/;  
 my $debug = shift @ARGV;  
11    
12  BEGIN {  BEGIN {
13          use_ok( 'WebPAC::Normalize' );          use_ok( 'WebPAC::Normalize' );
14  }  }
15    
16    use Data::Dump qw/dump/;
17    
18    my $debug = 0;
19    GetOptions(
20            "debug+", \$debug
21    );
22    
23    cmp_ok(_debug(1), '==', 1, '_debug level');
24    cmp_ok(_debug(0), '==', 0, '_debug level');
25    
26    diag "debug level for $0 is $debug" if ($debug);
27    if ($debug > 2) {
28            diag "debug level for WebPAC::Normalize is ", _debug( $debug - 2 );
29    }
30    
31  ok(my $abs_path = abs_path($0), "abs_path");  ok(my $abs_path = abs_path($0), "abs_path");
32  $abs_path =~ s#/[^/]*$#/#;  $abs_path =~ s#/[^/]*$#/#;
33  diag "abs_path: $abs_path" if ($debug);  diag "abs_path: $abs_path" if ($debug);
34    
 #throws_ok { new WebPAC::Normalize::XML( lookup_regex => 'foo' ) } qr/pair/, "lookup_regex without lookup";  
   
35  my $rec1 = {  my $rec1 = {
36          '200' => [{          '200' => [{
37                  'a' => '200a',                  'a' => '200a',
# Line 96  my $rec2 = { Line 107  my $rec2 = {
107  };  };
108    
109    
110  my $lookup1 = {  my $lookup_hash1 = {
111          '00900' => [          'db1' => {
112                  'lookup 1',                  'input1' => {
113                  'lookup 2',                          'key1' => { 1 => 1 },
114          ],                          'key2' => { 2 => 1 },
115                    },
116                    'input2' => {
117                            'key3' => { 3 => 1 },
118                            'key4' => { 4 => 1 },
119                    },
120            },
121            'db2' => {
122                    'input3' => {
123                            'key5' => { 5 => 1 },
124                            'key6' => { 6 => 1 },
125                    },
126            }
127  };  };
128    
129  my $lookup2 = {  my $lookup_hash2 = {
130          '00900' => 'lookup',          'db3' => {
131                    'input4' => {
132                            'key7' => { 7 => 1 },
133                            'key8' => { 8 => 1 },
134                    },
135            }
136  };  };
137    
   
138  sub test {  sub test {
139          print dump( @_ ), ("-" x 78), "\n";          print dump( @_ ), ("-" x 78), "\n";
140          ok( defined(@_) );          ok( defined(@_) );
# Line 135  sub test_s { Line 162  sub test_s {
162          my $eval_t = $t;          my $eval_t = $t;
163          $eval_t =~ s/[\n\r\s]+/ /gs;          $eval_t =~ s/[\n\r\s]+/ /gs;
164          $eval_t = substr($eval_t,0,$max_eval_output) . '...' if (length($eval_t) > $max_eval_output);          $eval_t = substr($eval_t,0,$max_eval_output) . '...' if (length($eval_t) > $max_eval_output);
165            $eval_t =~ s/\\/\\\\/gs;
166    
167          eval "$t";          my @__ret;
168          ok(! $@, $@ ? dump_error($@, $t) : "eval: $eval_t");          eval "\@__ret = $t";
169            ok(! $@, $@ ? dump_error($@, $t) : "eval: $eval_t = " . dump(@__ret));
170            return \@__ret;
171  }  }
172    
173  {  {
# Line 164  sub test_s { Line 194  sub test_s {
194          cmp_ok( join('', suffix('xy', 'cd') ), 'eq', 'cdxy', 'suffix');          cmp_ok( join('', suffix('xy', 'cd') ), 'eq', 'cdxy', 'suffix');
195          cmp_ok( join('', surround('->', '<-', 'a','b','c') ), 'eq', '->a<-->b<-->c<-', 'surround');          cmp_ok( join('', surround('->', '<-', 'a','b','c') ), 'eq', '->a<-->b<-->c<-', 'surround');
196    
197            # count
198            my @el;
199            for my $i ( 0 .. 10 ) {
200                    cmp_ok( count( @el ), '==', $i, "count($i)");
201                    push @el, "element $i";
202            }
203    
204            # lookups
205    
206            throws_ok { _set_load_row() } qr/CODE/, 'empty _set_load_row()';
207    
208            ok(_set_load_row(sub {
209                    my ($database,$input,$mfn) = @_;
210                    diag "load_row( $database, $input, $mfn )" if ($debug);
211                    cmp_ok( $#_, '==', 2, 'have 3 arguments');
212                    ok($database, '_load_row database');
213                    ok($input, '_load_row input');
214                    ok($mfn, '_load_row mfn');
215                    return {
216                            '900' => [{ x => '900x-' . $mfn , y => '900y-' . $mfn }],
217                    }
218    
219            }), '_set_load_row');
220    
221            my @v = qw/foo bar baz aaa bbb ccc ddd/;
222    
223            my @accumulated;
224    
225            for my $i ( 0 .. $#v ) {
226    
227                    my $mfn = 1000 + $i;
228    
229                    ok(WebPAC::Normalize::_set_config({ '_mfn' => $mfn }), "_set_config _mfn=$mfn");
230    
231                    my $size = $#v + 1;
232    
233                    cmp_ok(
234                            save_into_lookup('db','input','key', sub { @v }),
235                            '==', $size, "save_into_lookup $size values"
236                    );
237    
238                    ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup');
239                    diag "_get_lookup = ", dump($l) if ($debug);
240    
241                    my @lookup;
242    
243                    ok(@lookup = lookup(
244                                    sub {
245                                            diag "in show" if ($debug);
246                                            rec('900','x');
247                                    },
248                                    'db','input','key',
249                                    sub {
250                                            return @v;
251                                    }
252                            ),
253                    "lookup db/input/key");
254    
255                    push @accumulated, '900x-' . $mfn;
256    
257                    is_deeply(\@lookup, \@accumulated, "lookup db/input/key");
258    
259                    shift @v;
260    
261            }
262    
263            ok(my $l = WebPAC::Normalize::_get_lookup(), '_get_lookup');
264            diag "_get_lookup = ", dump($l) if ($debug);
265    
266            is_deeply( $l, {
267                    db => {
268                            input => {
269                                    key => {
270                                            foo => { 1000 => 1 },
271                                            bar => { 1000 => 1, 1001 => 1 },
272                                            baz => { 1000 => 1, 1001 => 1, 1002 => 1 },
273                                            aaa => { 1000 => 1, 1001 => 1, 1002 => 1, 1003 => 1 },
274                                            bbb => { 1000 => 1, 1001 => 1, 1002 => 1, 1003 => 1, 1004 => 1 },
275                                            ccc => { 1000 => 1, 1001 => 1, 1002 => 1, 1003 => 1, 1004 => 1, 1005 => 1 },
276                                            ddd => { 1000 => 1, 1001 => 1, 1002 => 1, 1003 => 1, 1004 => 1, 1005 => 1, 1006 => 1 },
277                                    },
278                            },
279                    },
280            }, 'lookup data');
281    
282    #######
283    
284            diag "lookup_hash1 = ", dump($lookup_hash1) if ($debug);
285            ok(_set_lookup( $lookup_hash1 ), '_set_lookup $lookup_hash1');
286    
287            throws_ok { _set_load_row() } qr/CODE/, 'empty _set_load_row()';
288    
289            ok(_set_load_row(sub {
290                    my ($database,$input,$mfn) = @_;
291                    diag "load_row( $database, $input, $mfn )";
292                    cmp_ok( $#_, '==', 2, 'have 3 arguments');
293                    ok($database, 'database');
294                    ok($input, 'input');
295                    ok($mfn, 'mfn');
296    
297            }), '_set_load_row');
298    
299    
300    #       cmp_ok(lookup(
301    #               sub {
302    #                       'found'
303    #               },
304    #               'db1','input1','key1',
305    #               sub {
306    #                       rec('200','a')
307    #               }
308    #       ), 'eq', 'found', 'lookup db1/input1/key1');
309    
310    
         _set_lookup( $lookup1 );  
311                    
312          cmp_ok(  #       cmp_ok(
313                  join_with(" i ",  #               lookup(
314                          lookup(  #               ),
315                                  regex( 's/^/00/',  #       'eq', 'lookup 1 i lookup 2', 'join lookup regex rec2');
                                         rec2('902','z')  
                                 )  
                         )  
                 ),  
         'eq', 'lookup 1 i lookup 2', 'join lookup regex rec2');  
316    
317          # check join_with operations          # check join_with operations
318    
# Line 219  sub test_s { Line 356  sub test_s {
356    
357          # test lookups          # test lookups
358    
359          _set_lookup( $lookup2 );          _set_lookup( $lookup_hash2 );
360    
361          is_deeply( \[ lookup( prefix( '00', rec('902') ) ) ], \[ 'lookup' ], 'lookup prefix' );          throws_ok { lookup() } qr/need/, 'empty lookup';
362    
363          ok(! lookup('non-existent'), 'lookup non-existant' );          #is_deeply( \[ lookup( prefix( '00', rec('902') ) ) ], \[ 'lookup' ], 'lookup prefix' );
364    
365            #ok(! lookup('non-existent'), 'lookup non-existant' );
366    
367          _set_rec( $rec2 );          _set_rec( $rec2 );
368    
# Line 341  sub test_s { Line 480  sub test_s {
480                  }                  }
481          }, 'correct get_ds');          }, 'correct get_ds');
482    
483            #
484          # MARC          # MARC
485            #
486            #_debug( 4 );
487    
488          test_s(qq{ marc_indicators('900',1,2) });          test_s(qq{ marc_indicators('900',1,2) });
489          test_s(qq{ marc('900','a', rec('200') ) });          test_s(qq{ marc('900','a', rec('200') ) });
490          my @marc;          my $marc;
491          ok(@marc = WebPAC::Normalize::_get_marc_fields(), "_get_marc_fields");          ok($marc = WebPAC::Normalize::_get_marc_fields(), "_get_marc_fields");
492          diag dump( \@marc ) if ($debug);          diag dump( $marc ) if ($debug);
493    
494          is_deeply( \@marc, [          is_deeply( $marc, [
495                  [ '900', 1, 2, 'a', '200a' ],                  [ '900', 1, 2, 'a', '200a' ],
496                  [ '900', 1, 2, 'a', '200-solo' ]                  [ '900', 1, 2, 'a', '200-solo' ]
497          ], 'correct marc with indicators');          ], 'correct marc with indicators');
# Line 356  sub test_s { Line 499  sub test_s {
499          test_s(qq{ marc_indicators('900',' ',9) });          test_s(qq{ marc_indicators('900',' ',9) });
500          test_s(qq{ marc_repeatable_subfield('900','a', rec('200') ) });          test_s(qq{ marc_repeatable_subfield('900','a', rec('200') ) });
501    
502          ok(@marc = WebPAC::Normalize::_get_marc_fields(), "_get_marc_fields");          ok($marc = WebPAC::Normalize::_get_marc_fields(), "_get_marc_fields");
503          diag dump( \@marc ) if ($debug);          diag dump( $marc ) if ($debug);
504    
505          is_deeply( \@marc, [          is_deeply( $marc, [
506                  [ '900', 1, 2, 'a', '200a', 'a', '200-solo' ],                  [ '900', 1, 2, 'a', '200a', 'a', '200-solo' ],
507                  [ '900', ' ', 9, 'a', '200a', 'a', '200-solo' ]                  [ '900', ' ', 9, 'a', '200a', 'a', '200-solo' ]
508          ], 'correct marc with repetable subfield');          ], 'correct marc with repetable subfield');
509    
510          _clean_ds();          #
511          _set_rec({          # test magic re-ordering of input data
512                  '200' => [{          #
513                          'a' => '200a-1',  
514                          'b' => '200b-1',          sub test_rec_rules {
515                          'c' => '200c-1',                  my ($msg, $rec, $rules, $struct) = @_;
516                  }, {  
517                          'a' => '200a-2',                  _clean_ds();
518                          'b' => '200b-2',                  _set_rec($rec);
519                          'c' => '200c-2',  
520                  }, {                  foreach my $r (split(/;/, $rules)) {
521                          'a' => '200a-3',                          $r =~ s/[\s\n\r]+/ /gs;
522                          'c' => '200c-3',                          $r =~ s/^\s+//gs;
523                  }]                          $r =~ s/\s+$//gs;
524          });                          test_s($r) if ($r);
525          test_s(qq{ marc_indicators('900',1 ,0) });                  }
526          test_s(qq{ marc_repeatable_subfield('900','a', rec('200','a') ) });  
527          test_s(qq{ marc('900','b', rec('200','b') ) });                  ok(my $marc = WebPAC::Normalize::_get_marc_fields(), "_get_marc_fields");
528          test_s(qq{ marc('900','c', rec('200','c') ) });                  diag dump( $marc ) if ($debug);
529                    diag "expects:\n", dump($struct) if ($debug > 1);
530          ok(@marc = WebPAC::Normalize::_get_marc_fields(), "_get_marc_fields");                  is_deeply( $marc, $struct, $msg );
531          diag dump( \@marc ) if ($debug);          }
532    
533          is_deeply( \@marc, [          test_rec_rules(
534                  [ '900', 1, 0, 'a', '200a-1', 'a', '200a-2', 'a', '200a-3', 'b', '200b-1', 'c', '200c-1' ],                  'correct marc with repetable subfield',
535                  [ '900', 1, 0, 'b', '200b-2', 'c', '200c-2' ],                  {
536                  [ '900', 1, 0, 'c', '200c-3' ],                          '200' => [{
537          ], 'correct marc with repetable subfield');                                  'a' => '200a-1',
538                                    'b' => '200b-1',
539                                    'c' => '200c-1',
540                            }, {
541                                    'a' => '200a-2',
542                                    'b' => '200b-2',
543                            }, {
544                                    'a' => '200a-3',
545                            }],
546                    },
547                    qq{
548                            marc_indicators('900',1 ,0);
549                            marc('900','a', rec('200','a') );
550                            marc('900','b', rec('200','b') );
551                            marc('900','c', rec('200','c') );
552                    },
553                    [
554                            [ '900', 1, 0, 'a', '200a-1', 'b', '200b-1', 'c', '200c-1' ],
555                            [ '900', 1, 0, 'a', '200a-2', 'b', '200b-2' ],
556                            [ '900', 1, 0, 'a', '200a-3' ],
557                    ],
558            );
559    
560    
561            test_rec_rules(
562                    'marc_repeatable_subfield',
563                    {
564                            '200' => [{
565                                    'a' => '200a-1',
566                                    'b' => '200b-1',
567                                    'c' => '200c-1',
568                            }, {
569                                    'a' => '200a-2',
570                                    'b' => '200b-2',
571                                    'c' => '200c-2',
572                            }, {
573                                    'a' => '200a-3',
574                                    'c' => '200c-3',
575                            }],
576                    },
577                    qq{
578                            marc_indicators('900',1 ,0);
579                            marc_repeatable_subfield('900','a', rec('200','a') );
580                            marc('900','b', rec('200','b') );
581                            marc('900','c', rec('200','c') );
582                    },
583                    [
584                            [ '900', 1, 0, 'a', '200a-1', 'a', '200a-2', 'a', '200a-3', 'b', '200b-1', 'c', '200c-1' ],
585                            [ '900', 1, 0, 'b', '200b-2', 'c', '200c-2' ],
586                            [ '900', 1, 0, 'c', '200c-3' ],
587                    ],
588            );
589    
590            test_rec_rules(
591                    'marc_compose',
592                    { '200' => [{ a => 'foo ; bar', b => 42, c => 'baz' }] },
593                    qq{
594                            marc_compose('900',
595                                    'c', rec(200,'b'),
596                                    'b', rec(200,'a'),
597                                    'a', rec(200,'c'),
598                            );
599                    },
600                    [
601                            [ '900', ' ', ' ', 'c', 42, 'b', 'foo ; bar', 'a', 'baz' ]
602                    ],
603            );
604    
605            test_rec_rules(
606                    'marc_compose with + subfields',
607                    { '200' => [{ a => 'foo ; bar', b => 42, c => 'baz' }] },
608                    qq{
609                            marc_compose('900',
610                                    'a', rec(200,'a'),
611                                    '+', prefix(" * ", rec(200,'c')),
612                                    'b', rec(200,'b'),
613                                    '+', prefix(" : ", rec(200,'c')),
614                            );
615                    },
616                    [
617                            [ '900', ' ', ' ', 'a', 'foo ; bar * baz', 'b', '42 : baz' ]
618                    ],
619            );
620    
621            #
622            # test rules
623            #
624            sub test_rule {
625                    my ($msg, $rec, $rule, $struct) = @_;
626                    _clean_ds();
627                    _set_rec( $rec );
628                    $rule =~ s/\\/\\/gs;
629                    my $r = test_s( $rule );
630                    diag "for ", dump($rec), " got:\n", dump($r), "\nexpect:\n" if ($debug > 1);
631                    diag dump($struct) if ($debug);
632                    is_deeply( $r, $struct, $msg );
633            }
634    
635            # test split_rec_on
636            test_rule(
637                    'split_rec_on',
638                    { '200' => [{ a => 'foo ; bar', b => 42, c => 'baz' }] },
639                    qq{ split_rec_on('200','a', qr/\\s*;\\s*/, 1) },
640                    [ 'foo' ],
641            );
642            test_rule(
643                    'split_rec_on',
644                    { '200' => [{ a => 'foo ; bar', b => 42, c => 'baz' }] },
645                    qq{ split_rec_on('200','a', qr/\\s*;\\s*/, 2) },
646                    [ 'bar' ],
647            );
648            test_rule(
649                    'split_rec_on no part',
650                    { '200' => [{ a => 'foo ; bar', b => 42, c => 'baz' }] },
651                    qq{ split_rec_on('200','a', qr/\\s*;\\s*/) },
652                    [ 'foo', 'bar' ],
653            );
654            test_rule(
655                    'split_rec_on no record',
656                    {},
657                    qq{ split_rec_on('200','a', qr/\\s*;\\s*/) },
658                    [ '' ],
659            );
660    
661            test_rec_rules(
662                    'marc_compose+split_rec_on',
663                    { '200' => [{ a => 'foo ! bar', b => 42, c => 'baz' }] },
664                    qq{
665                            marc_compose('900',
666                                    'a', split_rec_on(200,'a', qr/\\s*!\\s*/, 1),
667                                    'c', rec(200,'c'),
668                                    'a', split_rec_on(200,'a', qr/\\s*!\\s*/, 2),
669                                    'b', rec(200,'b'),
670                            );
671                    },
672                    [
673                            [ '900', ' ', ' ',
674                                    'a', 'foo',
675                                    'c', 'baz',
676                                    'a', 'bar',
677                                    'b', 42,
678                            ]
679                    ],
680            );
681    
682            cmp_ok(marc_leader('06',42), '==', 42, 'marc_leader');
683            cmp_ok(marc_leader('11',5), '==', 5, 'marc_leader');
684            ok(marc_leader(), 'marc_leader get');
685            diag "leader: ", dump(marc_leader()) if ($debug);
686            is_deeply(marc_leader(), { '06' => 42, 11 => 5 }, "marc_leader full");
687    
688            test_rule(
689                    'rec1(000)',
690                    { '000' => [ 42 ]},
691                    qq{ rec('000') },
692                    [ 42 ],
693            );
694    
695            test_rec_rules(
696                    'marc(001,rec(000))',
697                    { '000' => [ 42 ]},
698                    qq{
699                            marc('001', rec('000') );
700                    },
701                    [
702                            [ '001', 42, ]
703                    ],
704            );
705    
706            test_rec_rules(
707                    'marc_remove subfield',
708                    { '200' => [{ a => 42, b => 'bar', c => 'baz' }] },
709                    qq{
710                            marc('900', 'a', rec('200','a') );
711                            marc('900', 'b', rec('200','b') );
712                            marc_remove('900','b');
713                            marc('900', 'b', rec('200','c') );
714                            marc_remove('900','a');
715                    },
716                    [
717                            [ '900', ' ', ' ', 'b', 'baz' ],
718                    ],
719            );
720    
721            test_rec_rules(
722                    'marc_remove field',
723                    { '200' => [{ a => 42, b => 'bar', c => 'baz' }] },
724                    qq{
725                            marc('900', 'a', rec('200','a') );
726                            marc('900', 'b', rec('200','b') );
727                            marc('901', 'b', rec('200','b') );
728                            marc('901', 'c', rec('200','c') );
729                            marc_remove('900');
730                    },
731                    [
732                            [ '901', ' ', ' ', 'b', 'bar', 'c', 'baz' ],
733                    ],
734            );
735    
736            test_s(qq{ marc_remove('*'); });
737            ok(! WebPAC::Normalize::_get_marc_fields(), 'marc_remove(*)');
738    
739            test_rec_rules(
740                    'marc_duplicate',
741                    { '200' => [{ a => 42, b => 'bar', c => 'baz', d => 'bing', e => 'bong' }] },
742                    qq{
743                            marc('900', 'a', rec('200','a') );
744                            marc('900', 'b', rec('200','b') );
745                            marc_duplicate;
746                            marc_remove('900','b');
747                            marc('900', 'b', rec('200','c') );
748                            marc_duplicate;
749                            marc_remove('900','b');
750                            marc('900', 'b', rec('200','d') );
751                            marc_duplicate;
752                            marc_remove('900','b');
753                            marc('900', 'b', rec('200','e') );
754                    },
755                    [
756                            # this will return FIRST record
757                            [ '900', ' ', ' ', 'a', 42, 'b', 'bar' ],
758                    ],
759            );
760    
761            my $i = 0;
762            foreach my $v ( qw/bar baz bing bong/ ) {
763    
764                    ok($marc = WebPAC::Normalize::_get_marc_fields( offset => $i ),
765                            "_get_marc_fields( offset => $i )"
766                    );
767                    diag "marc $i = ", dump( $marc ) if ($debug);
768                    is_deeply( $marc,
769                            [ [ '900', ' ', ' ', 'a', 42, 'b', $v ] ],
770                            "MARC copy $i has $v",
771                    );
772                    $i++;
773            }
774    
775            test_rec_rules(
776                    'marc_original_order',
777                    {
778                            '200' => [ {
779                                    a => [ 'a1', 'a2' ], b => [ 'b1', 'b2' ], c => [ 'c1', 'c2' ],
780                                    subfields => [ qw/a 0 b 0 a 1 b 1 c 0 c 1/ ],
781                            }, {
782                                    a => [ 'a3', 'a4', 'a5' ], b => 'b3', c => 'c3',
783                                    subfields => [ qw/a 0 a 1 b 0 c 0 a 2/ ],
784                            } ],
785                    },
786                    qq{
787                            marc_original_order(900,200);
788                    },
789                    [
790                            [ '900', ' ', ' ', 'a', 'a1', 'b', 'b1', 'a', 'a2', 'b', 'b2', 'c', 'c1', 'c', 'c2', ],
791                            [ '900', ' ', ' ', 'a', 'a3', 'a', 'a4', 'b', 'b3', 'c', 'c3', 'a', 'a5', ],
792                    ],
793            );
794    
795            test_rule(
796                    'rec1 skips subfields',
797                    {
798                            '200' => [ {
799                                    a => [ 'a1', 'a2' ], b => [ 'b1', 'b2' ], c => [ 'c1', 'c2' ],
800                                    subfields => [ qw/a 0 b 0 a 1 b 1 c 0 c 1/ ],
801                            }, {
802                                    a => [ 'a3', 'a4', 'a5' ], b => 'b3', c => 'c3',
803                                    subfields => [ qw/a 0 a 1 b 0 c 0 a 2/ ],
804                            } ],
805                    },
806                    qq{
807                            rec1(200);
808                    },
809                    ['a1', 'b1', 'a2', 'b2', 'c1', 'c2', 'a3', 'a4', 'b3', 'c3', 'a5' ],
810            );
811    
812            is_deeply(
813                    [ _pack_subfields_hash({
814                            a => [ 'a1', 'a2' ], b => [ 'b1', 'b2' ], c => [ 'c1', 'c2' ],
815                            subfields => [ qw/a 0 b 0 a 1 b 1 c 0 c 1/ ],
816                    }) ],
817                    ['a1', 'b1', 'a2', 'b2', 'c1', 'c2'],
818                    '_pack_subfields_hash( $h )'
819            );
820    
821            cmp_ok(
822                    _pack_subfields_hash({
823                            a => [ 'a1', 'a2' ], b => [ 'b1', 'b2' ], c => [ 'c1', 'c2' ],
824                            subfields => [ qw/a 0 b 0 a 1 b 1 c 0 c 1/ ],
825                    }, 1),
826                    'eq',
827                    '^aa1^bb1^aa2^bb2^cc1^cc2',
828                    '_pack_subfields_hash( $h, 1 )'
829            );
830  }  }
831    

Legend:
Removed from v.550  
changed lines
  Added in v.811

  ViewVC Help
Powered by ViewVC 1.1.26