This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Module-Load to CPAN version 0.24
[perl5.git] / t / porting / regen.t
CommitLineData
3879ea51
NC
1#!./perl -w
2
3# Verify that all files generated by perl scripts are up to date.
4
3879ea51 5BEGIN {
208c2b59 6 @INC = '..' if -f '../TestInit.pm';
3879ea51 7}
208c2b59 8use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute
3879ea51
NC
9use strict;
10
c24c946d
NC
11require 'regen/regen_lib.pl';
12require 't/test.pl';
13$::NO_ENDING = $::NO_ENDING = 1;
14
b511b76c
CB
15if ( $^O eq "VMS" ) {
16 skip_all( "- regen.pl needs porting." );
17}
18
65aa4ca7 19my $in_regen_pl = 23; # I can't see a clean way to calculate this automatically.
d0817dbe 20my @files = qw(perly.act perly.h perly.tab keywords.c keywords.h uconfig.h);
ea52845d 21my @progs = qw(Porting/makemeta regen/regcharclass.pl regen/mk_PL_charclass.pl);
c24c946d 22
ea52845d 23plan (tests => $in_regen_pl + @files + @progs);
c24c946d
NC
24
25OUTER: foreach my $file (@files) {
26 open my $fh, '<', $file or die "Can't open $file: $!";
27 1 while defined($_ = <$fh>) and !/Generated from:/;
28 if (eof $fh) {
29 fail("Can't find 'Generated from' line in $file");
30 next;
31 }
32 my @bad;
33 while (<$fh>) {
34 last if /ex: set ro:/;
35 unless (/^(?: \* | #)([0-9a-f]+) (\S+)$/) {
36 chomp $_;
37 fail("Bad line in $file: '$_'");
38 next OUTER;
39 }
40 my $digest = digest($2);
41 note("$digest $2");
42 push @bad, $2 unless $digest eq $1;
43 }
44 is("@bad", '', "generated $file is up to date");
45}
3879ea51 46
ea52845d 47foreach (@progs, 'regen.pl') {
25bab59b
NC
48 system "$^X $_ --tap";
49}