/[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 1048 by dpavlin, Mon Nov 19 16:33:09 2007 UTC revision 1206 by dpavlin, Fri May 29 20:55:54 2009 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 344;  use Test::More tests => 355;
7    
8  BEGIN {  BEGIN {
9          use_ok( 'WebPAC::Test' );          use_ok( 'WebPAC::Test' );
# Line 866  sub test_s { Line 866  sub test_s {
866    
867          # frec          # frec
868    
869          my $rec = {          $rec = {
870                          '200' => [ {                          '200' => [ {
871                                  a => [ 'a1', 'a2' ], b => [ 'b1', 'b2' ], c => [ 'c1', 'c2' ],                                  a => [ 'a1', 'a2' ], b => [ 'b1', 'b2' ], c => [ 'c1', 'c2' ],
872                                  subfields => [ qw/a 0 b 0 a 1 b 1 c 0 c 1/ ],                                  subfields => [ qw/a 0 b 0 a 1 b 1 c 0 c 1/ ],
# Line 896  sub test_s { Line 896  sub test_s {
896          test_rule( 'rec(200,i1)', $rec, qq{ rec(200,'i1') }, [ '0' ] );          test_rule( 'rec(200,i1)', $rec, qq{ rec(200,'i1') }, [ '0' ] );
897          test_rule( 'rec(200,i2)', $rec, qq{ rec(200,'i2') }, [ '1' ] );          test_rule( 'rec(200,i2)', $rec, qq{ rec(200,'i2') }, [ '1' ] );
898    
899            my $hash = { a => '[a]', 'b' => '[b]', subfields => [ 'a', 0, 'b', 0 ] };
900            is_deeply([ _pack_subfields_hash( $hash ) ], [ '[a]', '[b]' ], '_pack_subfields_hash' );
901            ok( $hash->{subfields}, 'subfields exist' );
902            cmp_ok( _pack_subfields_hash( $hash, 1 ), 'eq', '^a[a]^b[b]', '_pack_subfields_hash' );
903            ok( $hash->{subfields}, 'subfields exist' );
904    
905            $rec = { 'arr' => [ 1, 2, 3 ] };
906            test_rule( 'rec_array', $rec, qq{ rec_array('arr') }, $rec->{arr} );
907    
908            _clean_ds();
909            _set_ds( $rec );
910            test_s(q{
911                            row( e => $_ ) foreach ( rec_array('arr') );
912            });
913            ok( my $rows = _get_ds->{_rows}, 'ds have _rows' );
914    
915            foreach my $i ( 1 .. 3 ) {
916                    cmp_ok( $rows->[ $i - 1 ]->{e}, '==', $i, "e $i" );
917            }
918    
919  }  }
920    

Legend:
Removed from v.1048  
changed lines
  Added in v.1206

  ViewVC Help
Powered by ViewVC 1.1.26