1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use Test::More tests => 89; |
use Test::More tests => 104; |
4 |
use Test::Exception; |
use Test::Exception; |
5 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
6 |
use blib; |
use blib; |
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_ascii, "dump_ascii $mfn"); |
81 |
|
diag $dump if ($debug); |
82 |
} |
} |
83 |
|
|
84 |
return @db; |
return @db; |
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 => { |
140 |
|
|
141 |
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'); |
142 |
|
|
143 |
|
diag dump($input); |
144 |
|
|
145 |
|
# break encapsulation, bad! bad! |
146 |
|
$input->{ll_db}->{record} = { |
147 |
|
900 => 'foo ; bar ; baz', |
148 |
|
}; |
149 |
|
|
150 |
|
$input->{modify_record} = { |
151 |
|
900 => { |
152 |
|
'*' => { |
153 |
|
' ; ' => 'a', |
154 |
|
} |
155 |
|
} |
156 |
|
}; |
157 |
|
|
158 |
|
diag "hacked: ",dump($input, $input->fetch); |