App-HPGL2Cadsoft
view release on metacpan or search on metacpan
t/01-basic.t view on Meta::CPAN
require Test::Exception;
require Test::Warn;
require Grid::Coord;
# Check we get an error message on missing input parameters
my $reporter;
can_ok ('App::HPGL2Cadsoft', qw(scaling_factor input_file output_file));
throws_ok { $reporter = App::HPGL2Cadsoft->new() } qr/Attribute .+ is required/, "Checking missing parameters";
throws_ok { $reporter = App::HPGL2Cadsoft->new(input_file => 't/stim/missing_file.hpgl') } qr/Could not open file .t\/stim\/missing_file.+/, "Checking missing file";
my $app = App::HPGL2Cadsoft->new(input_file => 't/stim/heart.hpgl');
ok $app, 'object created';
ok $app->isa('App::HPGL2Cadsoft'), 'and it is the right class';
# Check if parsing the example HPGL file yields the correct result
my ($lines, $skipped);
warning_like { ($lines, $skipped) = $app->_parse_hpgl() } qr/HPGL command not parsed: 'PUx'/, "HPGL parser";
is $lines, 506, 'parsed HPGL #lines correctly';
( run in 0.250 second using v1.01-cache-2.11-cpan-496ff517765 )