Skip Menu |

This queue is for tickets about the Test-Inline CPAN distribution.

Report information
The Basics
Id: 111520
Status: new
Priority: 0/
Queue: Test-Inline

Owner: Nobody in particular
Requestors: john.deighan [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: bug in generated test
Date: Thu, 28 Jan 2016 19:00:51 +0000
To: "bug-Test-Inline [...]" <bug-Test-Inline [...]>
From: John Deighan <john.deighan [...]>
Download (untitled) / with headers
text/plain 1.9k
When I use the code below to create a *.t file, the final blank line doesn't make it into the file. That causes it to not compile since the HEREDOC structure <<"" requires a blank like to end the HEREDOC string: (I can get around this bug by including both a blank line and a comment line, but that won't be obvious to everyone) Also, I'd like to request that you include Test::Exception automatically, in addition to Test::More since its tests dies_ok and throws_ok are very common tests. # --------------------------------------------------------------------------- sub parseOptions { my($queryop, $optionStr) = @_; my $hDesc = $hQueryOpDescriptors->{$queryop}; my $hOptions = {}; my $hFields; foreach my $line (split(/\n/, $optionStr)) { if ($line =~ /^ \s* ( ($IDENT) (?: \. ($IDENT) )? ) \s* (?: as \s+ ($IDENT) )? \s* $/x) { my($fullfield, $ident1, $ident2, $newname) = ($1,$2,$3,$4); my($table, $field); if ($ident2) { ($table,$field) = ($ident1, $ident2); if (!$hDesc->{hAllowedJoins}->{$table}) { croak("You can't join to $table in query op $queryop"); } } else { ($table,$field) = ($queryop, $ident1) } my $hTableDef = GetTableDef('CUSTOMER', $table); if (!exists($hTableDef->{Columns}->{$field})) { croak("Table $table does not contain field $field"); } $hFields->{$fullfield} = $newname || $field; } } $hOptions = $hFields if $hFields; return $hOptions; } # parseOptions() =head =begin testing MonthName use Test::Exception; use CustomerData; is_deeply(parseOptions('Schools', <<""), ID as iSchool Name as SchoolName { ID => 'iSchool', Name => 'SchoolName', }); is_deeply(parseOptions('Schools', <<""), ID as iSchool Name as School SchoolAreas.Name as SchoolArea { ID => 'iSchool', Name => 'School', 'SchoolAreas.Name' => 'SchoolArea', }); dies_ok(sub {parseOptions('Schools', <<"")}); ID as iSchool Packages.ID as iPackage =end testing =cut # ---------------------------------------------------------------------------

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to