Skip Menu |
 

This queue is for tickets about the CPAN-Changes CPAN distribution.

Report information
The Basics
Id: 87576
Status: open
Priority: 0/
Queue: CPAN-Changes

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.20
  • 0.21
  • 0.22
Fixed in: (no value)



Subject: CPAN-Changes test suite doesn't have a test to check Test::CPAN::Changes actually works
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
Message-ID: <rt-4.0.16-17511-1375567459-252.0-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1375567459-17511-2"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
Content-Length: 1061
There is no test in the test suite to check that: 1. Test::CPAN::Changes gives a PASS result to change logs conforming to the CPAN::Changes::Spec. 2. Test::CPAN::Changes gives a FAIL result to change logs not conforming to the CPAN::Changes::Spec. The attached file remedies that. Running this file shows that Test::CPAN::Changes has the following problems: 1. It produces a PASS result for Changes files containing versions "1.", ".1", "v1.2" and "1.2.3", even though they do not conform to CPAN::Meta::Spec. 2. It produces a PASS for Changes files containing the date "002000-01-14", even though that does not conform to W3CDTF. (IIRC, it conforms to ISO-8601, which is a superset of W3CDTF.) 3. It warns about the date "Sat Jan 8 00:00:00 GMT 2000", which does not conform to W3CDTF, but the result is still reported as a PASS. Also interesting to note, but probably sensible behaviour: it warns about the date "2000-01-09 00:00:00", even though that technically complies with the CPAN::Changes::Spec if you assume that "00:00:00" is a release note!
Subject: test-cpan-changes.t
MIME-Version: 1.0
Content-Type: application/x-troff; name="test-cpan-changes.t"
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline; filename="test-cpan-changes.t"
Content-Transfer-Encoding: base64
Content-Length: 3217
Download test-cpan-changes.t
text/x-perl 3.1k
=pod =head1 PURPOSE This test file tests that Test::CPAN::Changes correctly detects Changes files that do/don't conform to the CPAN::Changes::Spec. =head1 AUTHOR Toby Inkster E<lt>tobyink@cpan.orgE<gt>. =cut use strict; use warnings; use Test::Tester; use Test::More 0.96; use Test::CPAN::Changes; use File::Temp 'tempfile'; my $str; while (<DATA>) { unless (/^~~ (\S+): (.+)/) { $str .= $_; next; } my $type = $1; my $msg = $2; # Create a temp file and test it using Test::CPAN::Changes my ($fh, $filename) = tempfile; print {$fh} $str; close $fh; my (undef, @results) = run_tests(sub { changes_file_ok($filename) }); if ($type =~ /Date/) { # We're testing that Test::CPAN::Changes detected an invalid date ok(!$results[2]{ok}, "$type: $msg"); } elsif ($type =~ /Version/) { # We're testing that Test::CPAN::Changes detected an invalid version number ok(!$results[3]{ok}, "$type: $msg"); } elsif ($type =~ /OK/) { # We're testing that Test::CPAN::Changes accepted the changelog ok($results[1]{ok} && $results[2]{ok} && $results[3]{ok}, "$type: $msg"); } else { BAIL_OUT("something wrong in __DATA__"); } # Clean up $str = ''; unlink $filename; } done_testing; __DATA__ 1.23_04_05 2000-01-01 ~~ Version: "1.23_04_05" does not conform to CPAN::Meta::Spec's version format 1. 2000-01-02 ~~ Version: "1." does not conform to CPAN::Meta::Spec's version format .1 2000-01-03 ~~ Version: ".1" does not conform to CPAN::Meta::Spec's version format v1.2 2000-01-04 ~~ Version: "v1.2" does not conform to CPAN::Meta::Spec's version format 1.2.3 2000-01-05 ~~ Version: "1.2.3" does not conform to CPAN::Meta::Spec's version format v1.2_3_4 2000-01-06 ~~ Version: "v1.2_3_4" does not conform to CPAN::Meta::Spec's version format 1.200 7-1-2000 ~~ Date: "7-1-2000" does not conform to W3CDTF 1.200 Sat Jan 8 00:00:00 GMT 2000 ~~ Date: "Sat" does not conform to W3CDTF (note that "Jan 8 00:00:00 GMT 2000" should technically be considered the release note!) 1.200 2000-01-09 00:00:00 ~~ OK: "2000-01-09" conforms to W3CDTF (note that "00:00:00" should technically be considered the release note!) 1.200 2000-01 ~~ OK: "2000-01" conforms to W3CDTF 1.200 2000 ~~ OK: "2000" conforms to W3CDTF 1.200 2000-01-12T00:00:00.00000000000000000000Z ~~ OK: "2000-01-13T00:00:00.00000000000000000000Z" conforms to W3CDTF 1.200 00-01-13 ~~ Date: "00-01-13" does not conform to W3CDTF 1.200 002000-01-14 ~~ Date: "002000-01-14" does not conform to W3CDTF 1.234 2000-01-15 ~~ OK: "1.234" conforms to CPAN::Meta::Spec's version format 1.23_04 2000-01-16 ~~ OK: "1.23_04" conforms to CPAN::Meta::Spec's version format v1.2.3 2000-01-17 ~~ OK: "v1.2.3" conforms to CPAN::Meta::Spec's version format v1.2_3 2000-01-18 ~~ OK: "v1.2_3" conforms to CPAN::Meta::Spec's version format v1.2.3.4 2000-01-19 ~~ OK: "v1.2.3.4" conforms to CPAN::Meta::Spec's version format v1.2.3_4 2000-01-20 ~~ OK: "v1.2.3_4" conforms to CPAN::Meta::Spec's version format v2000.01.21 2000-01-21 ~~ OK: "v2000.01.21" conforms to CPAN::Meta::Spec's version format v1.2000.01.22 2000-01-21 ~~ OK: "v1.2000.01.22" conforms to CPAN::Meta::Spec's version format (even though it is discouraged)
MIME-Version: 1.0
In-Reply-To: <rt-4.0.16-17511-1375567459-252.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.16-17511-1375567459-252.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.16-9703-1376538065-1631.87576-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 2040
Download (untitled) / with headers
text/plain 1.9k
On Sat Aug 03 19:04:19 2013, TOBYINK wrote: Show quoted text
> There is no test in the test suite to check that: > > 1. Test::CPAN::Changes gives a PASS result to change logs conforming > to the CPAN::Changes::Spec. > > 2. Test::CPAN::Changes gives a FAIL result to change logs not > conforming to the CPAN::Changes::Spec. > > The attached file remedies that. > > Running this file shows that Test::CPAN::Changes has the following > problems: > > 1. It produces a PASS result for Changes files containing versions > "1.", ".1", "v1.2" and "1.2.3", even though they do not conform to > CPAN::Meta::Spec. > > 2. It produces a PASS for Changes files containing the date "002000- > 01-14", even though that does not conform to W3CDTF. (IIRC, it > conforms to ISO-8601, which is a superset of W3CDTF.) > > 3. It warns about the date "Sat Jan 8 00:00:00 GMT 2000", which does > not conform to W3CDTF, but the result is still reported as a PASS. > > Also interesting to note, but probably sensible behaviour: it warns > about the date "2000-01-09 00:00:00", even though that technically > complies with the CPAN::Changes::Spec if you assume that "00:00:00" is > a release note!
A few things: * This test really needed to be written, so thank you. * Version parsing is handled by version.pm -- we use its "lax" parsing in order to handle the largest number of acceptable values (within reason). Perhaps the spec should be updated to be more specific about how we handle versions -- CPAN::Meta::Spec is perhaps too strict for our needs. * The latest CPAN::Changes spec (0.03) allows the "T" marker to be optional in W3CDTF dates * We accept a number of date formats, but warn when they don't match the W3CDTF. The new Kwalitee Site will have this "warnings" notion soon. * With that in mind, if you can tidy things up based on the feedback above and mark the failing tests as "TODO", then I'd be happy to add the test in directly. Otherwise it will have to wait until I get a few more tuits to do it myself :) In any event, thanks again. -Brian


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.