diff options
author | Max Maischein <corion@corion.net> | 2009-12-20 20:48:08 +0100 |
---|---|---|
committer | Jesse Vincent <jesse@bestpractical.com> | 2009-12-20 15:06:20 -0500 |
commit | a27ed3b8870954559045bbc9e35d9aec37ab9d6c (patch) | |
tree | bd6d737ed018631f51de3aa5bc02d48572cd2a35 | |
parent | 65f8b4e7268e4e92274620b6945d509caa201532 (diff) | |
download | perl-a27ed3b8870954559045bbc9e35d9aec37ab9d6c.tar.gz |
Generate a stub for newly added tests since the last release (2nd try, with fixed pod)
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Porting/newtests-perldelta.pl | 88 |
2 files changed, 89 insertions, 0 deletions
@@ -4033,6 +4033,7 @@ Porting/makerel Release making utility Porting/make_snapshot.pl Make a tgz snapshot of our tree with a .patch file in it Porting/manicheck Check against MANIFEST Porting/manisort Sort the MANIFEST +Porting/newtests-perldelta.pl Generate Perldelta stub for newly added tests Porting/perldelta_template.pod Template for creating new perldelta.pod files Porting/podtidy Reformat pod using Pod::Tidy Porting/pumpkin.pod Guidelines and hints for Perl maintainers diff --git a/Porting/newtests-perldelta.pl b/Porting/newtests-perldelta.pl new file mode 100644 index 0000000000..33fe0bc9f7 --- /dev/null +++ b/Porting/newtests-perldelta.pl @@ -0,0 +1,88 @@ +#!perl -w +use 5.010; +use strict; +use Getopt::Long; +use Pod::Usage; +use Module::CoreList; +GetOptions( + 'spec|s:s' => \my $manifest, +) or pod2usage(); + +=head1 SYNOPSIS + + newtests-perldelta.pl [FROM TO] + +Output the added tests between the two last released versions of Perl + + newtests-perldelta.pl + +Output the added tests between the version tagged v5.11.1 +and this version + + newtests-perldelta.pl v5.11.1 HEAD + +=cut + +my $corelist = \%Module::CoreList::version; +my @versions = sort keys %$corelist; + +# by default, compare latest two version in CoreList; +my ($from, $to) = @ARGV; + +# Convert the numbers to git version tags +sub num2git { + my ($num) = @_; + $num =~ /^(5)\.(\d\d\d)(\d\d\d)/ + or die "Couldn't make sense of version number '$num'"; + sprintf 'v%d.%d.%d', $1,$2,$3; +}; + +$from //= num2git($versions[-2]); # / +$to //= num2git($versions[-1]); # / +$manifest //= 'MANIFEST'; # / + +warn "Finding newly added tests between $from..$to\n"; + +my @new_tests = + grep { m!^[-+](?:t|ext)/.*\.t\s+! } # only added/removed tests + `git diff $from..$to -- $manifest`; +chomp @new_tests; +if (! @new_tests) { + die "No new tests found between $from and $to."; +}; + +# Now remove those files whose lines were just shuffled around +# within MANIFEST +my %desc; +my %removed; +for (@new_tests) { + die "Weird diff line '$_' " unless /^([+-])(\S+\.t)(?:\s+(.*))?$/; + my ($mod,$file,$desc) = ($1,$2,$3); + $desc //= '<no description>'; # / to placate Padre highlighting + if ($mod eq '-') { + $removed{ $file } = $file; + }; + $desc{ $file } = $desc; +}; + +print <<HEAD; + +=head1 New Tests + +Many modules updated from CPAN incorporate new tests. + +=over 4 + +HEAD + +for my $file (sort keys %desc) { + next if $removed{ $file }; + print <<ITEM; +=item $file + +$desc{ $file } + +ITEM +}; + +say "=back\n";
\ No newline at end of file |