• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

bench/29-Aug-2021-5923

FindExt.tD04-Feb-20172.5 KiB7951

args_assert.tD01-Mar-20211.5 KiB6842

authors.tD07-Feb-20251.7 KiB4825

bench.tD07-Feb-202525.7 KiB855610

bench_selftest.tD13-Feb-2019198 114

bincompat.tD07-Feb-20251.9 KiB5948

checkcase.tD04-Feb-20171.3 KiB4926

checkcfgvar.tD07-Feb-20251.4 KiB3611

cmp_version.tD13-Feb-20191 KiB3210

copyright.tD07-Feb-20252.4 KiB9852

corelist.tD07-Feb-2025541 2416

customized.datD07-Feb-20252 KiB2625

customized.tD07-Feb-20253.5 KiB153104

deprecation.tD27-Jan-20254.4 KiB146121

diag.tD07-Feb-202524.5 KiB745633

dual-life.tD07-Feb-20252.1 KiB8357

exec-bit.tD07-Feb-20251.9 KiB7245

extrefs.tD07-Feb-20253.4 KiB13687

filenames.tD24-Mar-20141.9 KiB8360

globvar.tD07-Feb-20252.5 KiB9770

header_parser.tD14-May-202417.4 KiB621366

known_pod_issues.datD07-Feb-20258.2 KiB440439

libperl.tD07-Feb-202516.6 KiB515327

maintainers.tD04-Feb-20171,016 4727

makerel.tD27-Jan-2025874 3920

manifest.tD07-Feb-20253.6 KiB12375

perlfunc.tD04-Feb-20171.5 KiB4214

pod_rules.tD07-Feb-20251.2 KiB4518

podcheck.tD07-Feb-202585.7 KiB2,3121,377

re_context.tD02-Jul-20161.2 KiB4412

readme.tD07-Feb-20252.3 KiB8162

regen.tD07-Feb-20254.2 KiB147118

ss_dup.tD04-Feb-2017856 4129

test_bootstrap.tD01-Mar-20212.6 KiB8653

test_testlist.tD27-Jan-20252.8 KiB9585

update_authors.tD14-May-20247 KiB19187

utils.tD07-Feb-20253 KiB9554

readme.t

1#!./perl -w
2#
3# Check whether all files mentioned in Porting/README.pod exist in Porting and
4# vice versa.
5
6BEGIN {
7    @INC = '..' if -f '../TestInit.pm';
8}
9
10use TestInit qw(T); # T is chdir to the top level
11use strict;
12use warnings;
13require './t/test.pl';
14
15my @porting_files;
16open my $man, "MANIFEST" or die "Can't open MANIFEST: $!";
17while(<$man>) {
18    /^Porting\// and s/[\t\n].*//s, push @porting_files, $_;
19}
20close $man or die "Can't close MANIFEST: $!";
21# It seems that dying here is nicer than having several dozen failing tests
22# later.  But that assumes one will see the message from die.
23die "Can't get contents of Porting/ directory.\n" unless @porting_files > 1;
24
25open(my $fh, '<', 'Porting/README.pod') or die("Can't open Porting/README.pod: $!");
26
27my (@current_order, @sorted_order, %files_in_pod);
28while(<$fh>) {
29    next unless $_ =~ /^=head/;
30    my @matches = $_ =~ m/F<([^>]+)>/g;
31    for my $file (@matches) {
32        $files_in_pod{$file} = 1;
33        push @current_order, $file;
34    }
35}
36
37for my $file (@porting_files) {
38    $file =~ s!^Porting/!!;
39    next if $file =~ /^perl[0-9]+delta\.pod$/;
40    ok(exists($files_in_pod{$file}), "$file is mentioned in Porting/README.pod");
41    delete $files_in_pod{$file};
42}
43for my $file (keys %files_in_pod) {
44    fail("$file exists in Porting/");
45}
46
47# Check if the entries in the README are in some sort of order.
48eval {
49    require Unicode::Collate;
50    my $Collator = Unicode::Collate->new();
51    @sorted_order = $Collator->sort(@current_order);
52};
53
54if(@sorted_order) {
55    ok(eq_array(\@current_order, \@sorted_order), "Files are referenced in order") or
56        print_right_order();
57}
58else {
59    note('Unicode collation did not work.  Not checking order of entries.');
60}
61
62# Frankly this is a bit much for a porting test, but it exists now.
63sub print_right_order {
64    my $max = 0;
65    for(@current_order) {
66        my $l = length $_;
67        $max = $l if $l > $max;
68    }
69    $max = 36 if $max > 36;
70    note(sprintf " N   %-${max}s %-${max}s\n", "Correct", "Current");
71    for(0..$#current_order) {
72        my $wrong = $sorted_order[$_] eq $current_order[$_] ? '' : 'X';
73        my $line = sprintf "%2d %1s %-${max}s %-${max}s\n",
74            $_, $wrong, $sorted_order[$_], $current_order[$_];
75        $line =~ s{ ((?:  ){2,})}{" " . ". " x (length($1)/2)}e if $_&1;
76        note($line);
77    }
78}
79
80done_testing();
81