added header_first to WebPAC::Input::CSV
[webpac2] / t / 2-input-tsv.t
index 71c684a..0d2be5e 100755 (executable)
@@ -3,7 +3,7 @@
 use strict;
 use lib 'lib';
 
-use Test::More tests => 63;
+use Test::More tests => 84;
 
 BEGIN {
 use_ok( 'WebPAC::Test' );
@@ -39,3 +39,18 @@ foreach my $mfn ( 1 ... $size ) {
        diag "rec: ", dump($rec), "\n" if $debug;
 }
 
+ok(my $db = $input->open(
+       path => "$abs_path/data/header_first.tsv",
+       header_first => 1,
+), "open header_first");
+ok(my $size = $input->size, "size");
+cmp_ok( $size, '==', 9, 'size one leas because of header_first' );
+
+foreach my $mfn ( 1 ... $size ) {
+       my $rec = $input->fetch;
+       ok($rec, "fetch $mfn");
+
+       ok( $rec->{'publication_title'}, 'has publication_title' );
+       diag "rec: ", dump($rec), "\n" if $debug;
+}
+