Re: pls suggest me huge package in perl with testsuites

2003-02-12 Thread Vlad Harchev
On Tue, Feb 11, 2003 at 10:46:58AM -0800, Randal L. Schwartz wrote:
> The following message is a courtesy copy of an article
> that has been posted to perl.qa as well.
> 
> > "Vlad" == Vlad Harchev <[EMAIL PROTECTED]> writes:
> 
> Vlad> I'm testing some perl source code transformation tool (kinda
> Vlad> perl source code prettifier).
> 
> If you'll allow me access to your source, I can guarantee you to be
> able to write some code that will break upon your transformation.

 Currently I can't afford this, sorry.
 
> There's no way to perfectly parse Perl (thanks to prototypes).

 This is not a problem in my case. In my case the biggest problem is
unusual handling of whitespaces in the perl.

E.g. the following gives syntax error for perl-5.6.1:

quote begin
sub f( $
$ )
{
print "a";
};
quote end
while this doesn't:
quote begin
sub f( $ $ )
{
print "a";
};
quote end

The following functions act different due to features of perl parser:

sub f { { "blah"
, 2}; };

sub g { { "blah", 2}; };

- f() returns integer 2, g() returns reference to anonymous hash - though
the difference is only in amount of whitespace (whether there is a newline
after "blah").


I found a lot of cases when adding newline and/or space in the function body
makes the code treated as synaxically incorrect.

That's the biggest problem I encounter. 
Dunno, may be I should forward these my notes to some perl mailing list (which
one then?)..

> The question you probably want answered instead is "what is the
> likelyhood of that character sequence occurring in *production code?",
> correct?

 Yes, but extensive testing won't hurt.
 
> But, if you want me to break it, let me know.

 Thank you for the offer, I will try it myself first :)
-- 
 Best regards,
  -Vlad



Re: pls suggest me huge package in perl with testsuites

2003-02-12 Thread schwern
On Tue, Feb 11, 2003 at 10:46:58AM -0800, Randal L. Schwartz wrote:
> > "Vlad" == Vlad Harchev <[EMAIL PROTECTED]> writes:
> 
> Vlad> I'm testing some perl source code transformation tool (kinda
> Vlad> perl source code prettifier).
> 
> If you'll allow me access to your source, I can guarantee you to be
> able to write some code that will break upon your transformation.
> 
> There's no way to perfectly parse Perl (thanks to prototypes).

Degenerative cases aside, a very good test of actual code anyone would 
use in production in real life for a Perl parsing attempt is
Test::More (since it has a few odd constructs and a good test suite), 
ExtUtils::MakeMaker and Test::Harness (both contain lots of old cruft 
and strange styles and decent test suites).

PPI (Parse Perl Isolated) does a very good job.

-- 



Re: pls suggest me huge package in perl with testsuites

2003-02-12 Thread Rafael Garcia-Suarez
schwern wrote in perl.qa :
> 
> Degenerative cases aside, a very good test of actual code anyone would 
> use in production in real life for a Perl parsing attempt is
> Test::More (since it has a few odd constructs and a good test suite), 

Good advice. Test::More actually helped me to find bugs in B::Deparse,
but that's because it's extensively used by perl 5.8's test suite.

> ExtUtils::MakeMaker and Test::Harness (both contain lots of old cruft 
> and strange styles and decent test suites).

And let's not forget t/japh/abigail.t in the perl 5.8.0 tarball ;-