modify record test which fails (with slash /), tweaks
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 4 Feb 2007 12:20:54 +0000 (12:20 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 4 Feb 2007 12:20:54 +0000 (12:20 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@794 07558da8-63fa-0310-ba24-9fe276d99e06

t/2-input.t

index cb3fef4..96bfb7f 100755 (executable)
@@ -105,7 +105,7 @@ test_start_limit($input, 3, $size, $size - 2);
 test_start_limit($input, 1, $size + 2, $size);
 
 ok(my $s = $input->stats, 'stats');
-diag "stats:\n$s";
+diag "stats:\n$s" if ($debug);
 
 $module = 'WebPAC::Input::MARC';
 diag "testing with $module";
@@ -132,27 +132,38 @@ ok($input->open(
        modify_records => {
                200 => {
                        '*' => { '^c' => '. ' },
+                       '^f' => { ' : ' => ' / ' },
                }
        },
 ), "open modify_isis (with modify_records)");
 
 ok(my $rec = $input->fetch, 'fetch');
+diag "fetched rec field 200 = ", dump($rec->{200}) if ($debug);
 
 cmp_ok($rec_p->{200}->[0]->{f} . '. ' . $rec_p->{200}->[0]->{c}, 'eq' ,$rec->{200}->[0]->{f}, 'modify_records working');
 
-diag dump($input);
+diag "input = ",dump($input->{data}) if ($debug);
 
 # break encapsulation, bad! bad!
-$input->{ll_db}->{record} = {
+$input->{ll_db}->{_isis_db}->{record} = {
        900 => 'foo ; bar ; baz',
 };
 
 $input->{modify_record} = {
        900 => {
-               '*' => {
-                       ' ; ' => 'a',
-               }
+               '*' => [
+                       { ' ; ' => 'a' },
+                       { ' ; ' => 'b' },
+                       { ' ; ' => 'c' },
+               ],
        }
 };
 
-diag "hacked: ",dump($input, $input->fetch);
+diag "hacked: ",dump($input, $input->fetch) if ($debug);
+
+# seek
+throws_ok { $input->seek } qw/without/, 'seek without position';
+cmp_ok($input->seek(0), '==', -1, 'seek');
+
+ok(my $rec = $input->fetch, 'fetch');
+diag "fetched rec = ", dump($rec) if ($debug);