This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add to known_pod_issues.dat following Test-Harness upgrade
[perl5.git] / t / porting / dual-life.t
1 #!/perl -w
2 use 5.010;
3 use strict;
4
5 # This tests properties of dual-life modules:
6 #
7 # * Are all dual-life programs being generated in utils/?
8
9 chdir 't';
10 require './test.pl';
11
12 plan('no_plan');
13
14 use File::Basename;
15 use File::Find;
16 use File::Spec::Functions;
17
18 # Exceptions that are found in dual-life bin dirs but aren't
19 # installed by default; some occur only during testing:
20 my $not_installed = qr{^(?:
21   \.\./cpan/Encode/bin/u(?:cm(?:2table|lint|sort)|nidump)
22    |
23   \.\./cpan/Module-Build/MB-[\w\d]+/Simple/(?:test_install/)?bin/.*
24 )\z}ix;
25
26 my %dist_dir_exe;
27
28 $dist_dir_exe{lc "podselect.PL"} = "../cpan/Pod-Parser/podselect";
29 $dist_dir_exe{lc "podchecker.PL"} = "../cpan/Pod-Checker/podchecker";
30 $dist_dir_exe{lc "pod2usage.PL"} = "../cpan/Pod-Usage/pod2usage";
31
32 foreach (qw (pod2man pod2text)) {
33     $dist_dir_exe{lc "$_.PL"} = "../cpan/podlators/$_";
34 };
35 $dist_dir_exe{'pod2html.pl'} = '../ext/Pod-Html';
36
37 my @programs;
38
39 find(
40   { no_chidr => 1, wanted => sub {
41     my $name = $File::Find::name;
42     return if $name =~ /blib/;
43     return unless $name =~ m{/(?:bin|scripts?)/\S+\z} && $name !~ m{/t/};
44
45     push @programs, $name;
46   }},
47   qw( ../cpan ../dist ../ext ),
48 );
49
50 my $ext = $^O eq 'VMS' ? '.com' : '';
51
52 for my $f ( @programs ) {
53   $f =~ s/\.\z// if $^O eq 'VMS';
54   next if $f =~ $not_installed;
55   my $bn = basename($f);
56   if(grep { /\A(?i:$bn)\z/ } keys %dist_dir_exe) {
57     ok( -f "$dist_dir_exe{lc $bn}$ext", "$f$ext");
58   } else {
59     ok( -f catfile('..', 'utils', "$bn$ext"), "$f$ext" );
60   }
61 }
62