2 ## Quick test for null_as_undef
7 use Test
::More tests
=> 12;
9 use DataExtract
::FixedWidth
;
11 my $file = File
::Spec
->catfile( 't', 'data', 'Nulls.txt' );
12 open ( my $fh, $file ) || die "Can not open $file";
14 while ( my $line = <$fh> ) {
18 $fw = DataExtract
::FixedWidth
->new({
24 my $arrRef = $fw->parse( $line );
25 my $hashRef = $fw->parse_hash( $line );
29 ok
( $hashRef->{id
} eq 1, "Testing output (->parse_hash)" );
30 ok
( $hashRef->{name
} eq 'Amy', "Testing output (->parse_hash)" );
31 ok
( !defined $hashRef->{team
}, "Testing output (->parse_hash)" );
33 ok
( $arrRef->[0] eq '1', "Testing output (->parse)" );
34 ok
( $arrRef->[1] eq 'Amy', "Testing output (->parse)" );
35 ok
( !defined $arrRef->[2], "Testing output (->parse)" );
38 ok
( !defined $hashRef->{id
}, "Testing output (->parse_hash)" );
39 ok
( $hashRef->{name
} eq 'Amy', "Testing output (->parse_hash)" );
40 ok
( $hashRef->{team
} eq 'Reds', "Testing output (->parse_hash)" );
42 ok
( !defined $arrRef->[0], "Testing output (->parse)" );
43 ok
( $arrRef->[1] eq 'Amy', "Testing output (->parse)" );
44 ok
( $arrRef->[2] eq 'Reds', "Testing output (->parse)" );