added note of git repo
[DataExtract-FixedWidth.git] / t / 11-Heuristic-ShortFirstRow.t
blob40522d569209323f6dd41cecd4d0c48c5ed200ea
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use feature ':5.10';
6 ##
7 ## In version .06 this test failed
8 ## I got the longer a19a9a14a13a5A* instead of a19a9a14a13A*
9 ## This was because the length for the heuristic was set statically to the
10 ## first row rather than the longest row
13 use DataExtract::FixedWidth;
14 use IO::File;
16 use Test::More tests => 1;
18 use File::Spec;
19 my $file = File::Spec->catfile( 't', 'data', 'larochenew.TXT' );
20 my $fh = IO::File->new( $file );
21 my @lines = grep /\w/, $fh->getlines;
23 my $defw = DataExtract::FixedWidth->new({
24 heuristic => \@lines
25 , cols => [ qw/vin stock color price miles/ ]
26 , header_row => undef
27 });
29 is ( $defw->unpack_string, 'a19a9a14a13A*', 'Heuristic not affected by being short' );