finialized changes, added moose prereq because of immutable status
[DataExtract-FixedWidth.git] / t / 08-SingleColumn.t
blobdb0926ab2db8233bb2068c86f71c1b6076b6f180
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
5 use feature ':5.10';
7 use File::Spec;
8 use DataExtract::FixedWidth;
9 use Test::More tests => 4;
11 my $file = File::Spec->catfile( 't', 'data', 'SingleCol.txt' );
12 open ( my $fh, $file ) || die "Can not open $file";
14 my @lines = <$fh>;
16 my $fw = DataExtract::FixedWidth->new({ heuristic => \@lines });
18 foreach my $idx ( 0 .. @lines ) {
19 my $row = $fw->parse( $lines[$idx] );
20 my $col = $row->[0];
22 given ( $idx ) {
23 when ( 0 ) { ok ( !defined $col, 'undef header row' ) }
24 when ( 1 ) { ok ( $col eq 'a', "Wanted 'a', got '$col'" ) }
25 when ( 2 ) { ok ( $col eq 'b', 'resp b' ) }
26 when ( 3 ) { ok ( $col eq 'cccccccc', "Wanted 'cccccccc', got '$col'" ) }