Data-Tabular-Dumper
view release on metacpan or search on metacpan
t/30_dump.t view on Meta::CPAN
qq( <all>the</all>\n),
qq( <mst3ks>man</mst3ks>\n),
qq( <who>has</who>\n),
qq( </record>\n),
qq( <record>\n),
qq( <biff>42</biff>\n),
qq( <boff>42</boff>\n),
qq( </record>\n),
qq( <record>\n),
qq( <all>42</all>\n),
qq( <mst3ks>42</mst3ks>\n),
qq( <who>42</who>\n),
qq( </record>\n),
qq( </Page_1>\n),
qq( <Page_2>\n),
qq( <record>\n),
qq( <billy>1</billy>\n),
qq( <bobby>42</bobby>\n),
qq( </record>\n),
qq( <record>\n),
qq( <bin>1</bin>\n),
qq( <zin>1</zin>\n),
qq( </record>\n),
qq( </Page_2>\n),
qq(</table>\n),
]
},
# dataHoHoL
);
##################################################################
foreach my $name ( sort keys %tests ) {
my $test = $tests{$name};
foreach my $p ( values %params ) {
next unless ref $p;
$p->[0] =~ s/30-\w+/30-$name/;
}
# diag( $name );
my $dumper = Data::Tabular::Dumper->open( %params );
$dumper->dump( $test->{data} );
$dumper->close;
foreach my $t ( qw( CSV XML Excel ) ) {
SKIP: {
skip "$t support not available", 2 unless $params{$t};
ok( (-f $params{$t}[0]), "Created $name ($t)" );
if( $t eq 'Excel' ) {
unlink( $params{ $t }[0] );
skip "Can't verify $t files", 1;
}
my @content = eval {
local @ARGV = ( $params{$t}[0] );
<>;
};
die $@ if $@;
is_deeply( \@content, $test->{$t}, "OK" )
or die "$params{$t}[0]";
unlink( $params{$t}[0] );
}
}
}
( run in 0.799 second using v1.01-cache-2.11-cpan-4ef0a570458 )