/[webpac2]/trunk/t/2-input.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-input.t

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

revision 774 by dpavlin, Fri Nov 3 20:56:21 2006 UTC revision 794 by dpavlin, Sun Feb 4 12:20:54 2007 UTC
# Line 105  test_start_limit($input, 3, $size, $size Line 105  test_start_limit($input, 3, $size, $size
105  test_start_limit($input, 1, $size + 2, $size);  test_start_limit($input, 1, $size + 2, $size);
106    
107  ok(my $s = $input->stats, 'stats');  ok(my $s = $input->stats, 'stats');
108  diag "stats:\n$s";  diag "stats:\n$s" if ($debug);
109    
110  $module = 'WebPAC::Input::MARC';  $module = 'WebPAC::Input::MARC';
111  diag "testing with $module";  diag "testing with $module";
# Line 125  ok($input = new WebPAC::Input( module => Line 125  ok($input = new WebPAC::Input( module =>
125  ok($input->open( path => "$abs_path/modify_isis/LIBRI", ), "open modify_isis (plain)");  ok($input->open( path => "$abs_path/modify_isis/LIBRI", ), "open modify_isis (plain)");
126  ok(my $rec_p = $input->fetch, 'fetch');  ok(my $rec_p = $input->fetch, 'fetch');
127    
128    # modify_records
129    
130  ok($input->open(  ok($input->open(
131          path => "$abs_path/modify_isis/LIBRI",          path => "$abs_path/modify_isis/LIBRI",
132          modify_records => {          modify_records => {
133                  200 => {                  200 => {
134                          '*' => { '^c' => '. ' },                          '*' => { '^c' => '. ' },
135                            '^f' => { ' : ' => ' / ' },
136                  }                  }
137          },          },
138  ), "open modify_isis (with modify_records)");  ), "open modify_isis (with modify_records)");
139    
140  ok(my $rec = $input->fetch, 'fetch');  ok(my $rec = $input->fetch, 'fetch');
141    diag "fetched rec field 200 = ", dump($rec->{200}) if ($debug);
142    
143  cmp_ok($rec_p->{200}->[0]->{f} . '. ' . $rec_p->{200}->[0]->{c}, 'eq' ,$rec->{200}->[0]->{f}, 'modify_records working');  cmp_ok($rec_p->{200}->[0]->{f} . '. ' . $rec_p->{200}->[0]->{c}, 'eq' ,$rec->{200}->[0]->{f}, 'modify_records working');
144    
145    diag "input = ",dump($input->{data}) if ($debug);
146    
147    # break encapsulation, bad! bad!
148    $input->{ll_db}->{_isis_db}->{record} = {
149            900 => 'foo ; bar ; baz',
150    };
151    
152    $input->{modify_record} = {
153            900 => {
154                    '*' => [
155                            { ' ; ' => 'a' },
156                            { ' ; ' => 'b' },
157                            { ' ; ' => 'c' },
158                    ],
159            }
160    };
161    
162    diag "hacked: ",dump($input, $input->fetch) if ($debug);
163    
164    # seek
165    throws_ok { $input->seek } qw/without/, 'seek without position';
166    cmp_ok($input->seek(0), '==', -1, 'seek');
167    
168    ok(my $rec = $input->fetch, 'fetch');
169    diag "fetched rec = ", dump($rec) if ($debug);

Legend:
Removed from v.774  
changed lines
  Added in v.794

  ViewVC Help
Powered by ViewVC 1.1.26