77 |
ok(my $rec = $input->fetch, "fetch $mfn"); |
ok(my $rec = $input->fetch, "fetch $mfn"); |
78 |
cmp_ok($input->pos, '==', $mfn, "pos $mfn"); |
cmp_ok($input->pos, '==', $mfn, "pos $mfn"); |
79 |
push @db, $rec; |
push @db, $rec; |
80 |
ok(my $dump = $input->dump, "dump $mfn"); |
ok(my $dump = $input->dump_ascii, "dump_ascii $mfn"); |
81 |
diag $dump if ($debug); |
diag $dump if ($debug); |
82 |
} |
} |
83 |
|
|
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"; |
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); |