develooper Front page | perl.perl5.porters | Postings from February 2001

Re: [PATCH t/pod/find.t t/TEST] fixing t/pod/find.t, running t/pod

From:
Jarkko Hietaniemi
Date:
February 23, 2001 06:50
Subject:
Re: [PATCH t/pod/find.t t/TEST] fixing t/pod/find.t, running t/pod
Message ID:
20010223084541.H21295@chaos.wustl.edu
On Fri, Feb 23, 2001 at 03:21:37AM -0500, schwern@pobox.com wrote:
> I just noticed t/pod and that its not run with "make test".
> This appears to have come up before and was an oversight.
>
> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-09/msg00730.html
> 
> Looks like people just gave up on fixing t/pod/find.t and I don't
> blame them, its a mess.  I'm tempted to just chuck it and start over.

Yup, I tried turning them on and got a truckload or few of errors,
no one at the time felt like fixing them.

> Well, the fundemental problem is that Pod::Find is doing all sorts of
> gyrations to look at the source code.  This is fundementally
> unmaintainable (tests should not break when we add new files to the
> dist).  Instead, I've added t/pod/test_pods/ to provide a little
> controled sandbox for Pod::Find to play in.
> 
> Could one of the VMS folks look over the VMS specific parts of this
> test and see if they can be eliminated or scaled down?
> 
> Out of curiousity, where did Pod::Find come from?  I can't find it
> anywhere on CPAN yet the test is written as if it was expecting to be
> run as part of a module install, not a core test.
> 
> Here's a patch to fix t/pod/find.t and add t/pod to t/TEST so it will
> run as part of make test.  I've added a t/pod/test_pods directory and
> some dummy files in it for Pod::Find to test against.
> 
> --- t/pod/find.t	2001/02/23 08:07:47	1.1
> +++ t/pod/find.t	2001/02/23 08:08:08
> @@ -14,31 +14,24 @@
>  ok(1);
>  
>  require Cwd;
> -my $THISDIR = Cwd::cwd();
>  my $VERBOSE = 0;
> -my $lib_dir = File::Spec->catdir($THISDIR,'lib');
> +my $lib_dir = File::Spec->catdir('pod', 'test_pods', 'lib');
>  if ($^O eq 'VMS') {
> -    $lib_dir = VMS::Filespec::unixify(File::Spec->catdir($THISDIR,'-','lib','pod'));
> +    $lib_dir = VMS::Filespec::unixify(File::Spec->catdir('pod', 'test_pods', 'lib'));
>      $Qlib_dir = $lib_dir;
>      $Qlib_dir =~ s#\/#::#g;
>  }
>  print "### searching $lib_dir\n";
> -my %pods = pod_find("$lib_dir");
> -my $result = join("\n### ", sort values %pods);
> -print "### found $result\n";
> -my $compare = join(',', qw(
> -    Pod::Checker
> -    Pod::Find
> -    Pod::InputObjects
> -    Pod::ParseUtils
> -    Pod::Parser
> -    Pod::PlainText
> -    Pod::Select
> -    Pod::Usage
> +my %pods = pod_find($lib_dir);
> +my $result = join(',', sort values %pods);
> +my $compare = join(',', sort qw(
> +    Pod::Stuff
> +    Pod::Rhubarb
> +    Like::And::Yeah
>  ));
>  if ($^O eq 'VMS') {
>      $compare = lc($compare);
> -    $result = join(',', sort grep(/pod::/, values %pods));
> +    $result = join(',', sort values %pods);
>      my $undollared = $Qlib_dir;
>      $undollared =~ s/\$/\\\$/g;
>      $undollared =~ s/\-/\\\-/g;
> @@ -55,8 +48,6 @@
>      ok($result,$compare);
>  }
>  
> -# File::Find is located in this place since eons
> -# and on all platforms, hopefully
>  
>  print "### searching for File::Find\n";
>  $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
> @@ -71,25 +62,24 @@
>      ok($result,$compare);
>  }
>  else {
> -    $compare = File::Spec->catfile($Config::Config{privlib},"File","Find.pm");
> +    $compare = File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm');
>      ok(_canon($result),_canon($compare));
>  }
>  
>  # Search for a documentation pod rather than a module
>  print "### searching for perlfunc.pod\n";
> -$result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'perlfunc')
> +my $search = File::Spec->catfile('pod', 'test_pods', 'pod');
> +$result = pod_where({ -dirs => [$search], -verbose => $VERBOSE }, 'perlfoo')
>    || 'undef - perlfunc.pod not found!';
>  print "### found $result\n";
>  
> -if ($^O eq 'VMS') { # privlib is perl_root:[lib] unfortunately
> -    $compare = "/lib/pod/perlfunc.pod";
> +if ($^O eq 'VMS') {
>      $result = VMS::Filespec::unixify($result);
> -    $result =~ s/perl_root\///i;
>      $result =~ s/^\.\.//;  # needed under `mms test`
>      ok($result,$compare);
>  }
>  else {
> -    $compare = File::Spec->catfile($Config::Config{privlib},"perlfunc.pod");
> +    $compare = File::Spec->catfile('pod', 'test_pods', 'pod' ,'perlfunc.pod');
>      ok(_canon($result),_canon($compare));
>  }
>  
> --- /dev/null	Tue Dec 12 01:02:04 2000
> +++ t/pod/test_pods/lib/Like/And/Yeah.pm	Fri Feb 23 02:55:13 2001
> @@ -0,0 +1,13 @@
> +package Like::And::Yeah;
> +
> +=head1 Umm
> +
> +Ya know and stuff
> +
> +=head1 Things
> +
> +Things are neat.  And stuff.  Whatever.
> +
> +=head2 Ummm
> +
> +Errr whatever.
> --- /dev/null	Tue Dec 12 01:02:04 2000
> +++ t/pod/test_pods/lib/Pod/Rhubarb.pod	Fri Feb 23 02:52:33 2001
> @@ -0,0 +1,15 @@
> +=head1 RHUBARB
> +
> +Rhubarb - rhubarb rhubarb
> +
> +=head1 rhubarb
> +
> +Rhubarb rhubarb rhubarb
> +
> +=over 4
> +
> +=item B<rhubarb>
> +
> +  my $rhubarb = rhubarb($rhubarb, $rhubarb, \%rhubarb);
> +
> +=back
> --- /dev/null	Tue Dec 12 01:02:04 2000
> +++ t/pod/test_pods/lib/Pod/Stuff.pm	Fri Feb 23 02:51:18 2001
> @@ -0,0 +1,20 @@
> +=head1 NAME
> +
> +Pod::Stuff - dummy testing pod
> +
> +=head1 DESCRIPTION
> +
> +This isn't really anything, its just some dummy pod code.
> +And stuff.
> +
> +Lots of stuff.
> +
> +=head2 STUFF
> +
> +For all your stuff [tm]
> +
> +Stuffit
> +
> +Mmmm, stuffed pizza bread.
> +
> +=cut
> --- MANIFEST	2001/02/18 18:51:54	1.5
> +++ MANIFEST	2001/02/23 08:16:39
> @@ -1669,6 +1669,10 @@
>  t/pod/testcmp.pl	Module to compare output against expected results
>  t/pod/testp2pt.pl	Module to test Pod::PlainText for a given file
>  t/pod/testpchk.pl	Module to test Pod::Checker for a given file
> +t/pod/test_pods/lib/Like/And/Yeah.pm    Sample data for find.t
> +t/pod/test_pods/lib/Pod/Rhubarb.pod     Sample data for find.t
> +t/pod/test_pods/lib/Pod/Stuff.pm        Sample data for find.t
> +t/pod/test_pods/pod/perlfoo.pod         Sample data for find.t
>  t/pragma/constant.t	See if compile-time constants work
>  t/pragma/diagnostics.t	See if diagnostics.pm works
>  t/pragma/locale.t	See if locale support works
> --- t/TEST	2001/02/23 08:10:52	1.1
> +++ t/TEST	2001/02/23 08:10:58
> @@ -27,7 +27,7 @@
>  
>  if ($#ARGV == -1) {
>      @ARGV = split(/[ \n]/,
> -      `echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t`);
> +      `echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t pod/*.t`);
>  }
>  
>  %infinite = ( 'comp/require.t', 1, 'op/bop.t', 1, 'lib/hostname.t', 1 ); 
> 
> 
> 
> -- 
> Michael G Schwern   <schwern@pobox.com>   http://www.pobox.com/~schwern/
> Perl6 Quality Assurance     <perl-qa@perl.org>       Kwalitee Is Job One

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About