NAME
Test::Changes::Strict::Simple - Strict semantic validation for CPAN Changes files
SYNOPSIS
use Test::More;
use Test::Changes::Strict::Simple qw(changes_strict_ok);
changes_strict_ok('Changes');
done_testing;
Typically used in xt/release/ and guarded by:
plan skip_all => 'Release tests only'
unless $ENV{RELEASE_TESTING};
DESCRIPTION
Test::Changes::Strict::Simple provides strict semantic validation for
CPAN-style Changes files.
While other modules focus primarily on structural validation, this module performs additional consistency checks, including:
-
The indentations must be uniform.
-
No trailing spaces.
-
No white characters other than spaces.
-
No more than three blank lines at the end of the file.
-
No version without items
-
First line must be a title matching:
qr/ ^ Revision\ history\ for\ (?: (?:perl\ )? (?: (?:module\ \w+(?:::\w+)*) | (?:distribution\ \w+(?:-\w+)*) ) ) $ /x; -
Title lines and version lines are never indented.
-
A version line consists of a version string and a date separated by blanks.
-
Dates match
/\d+\.\d+/. -
Versions are strictly monotonically increasing.
-
Release dates are valid calendar dates.
-
Release dates are not in the future.
-
Release dates are not earlier than the first public Perl release (1987).
-
Release dates are monotonically non-decreasing (multiple releases on the same day are allowed).
Note: an item can span more than one line.
Example of a valid Changes file:
Revision history for distribution Foo-Bar-Baz
0.03 2024-03-01
- Another version, same day.
0.02 2024-03-01
- Bugfix.
- Added a very fancy feature that alllows this
and that.
- Another bugfix.
0.01 2024-02-28
- Initial release. This will hopefully work
fine.
The module is intended for use in release testing and helps detect common mistakes such as version regressions, invalid dates, and chronological inconsistencies.
EXPORT
By default, the following symbols are exported:
changes_strict_ok
IMPORT OPTIONS
-check_dots => BOOL
By default, items must end with a period. This check can be disabled by
passing -check_dots with a value of false. Example:
use Test::Changes::Strict::Simple -check_dots => 0;
-empty_line_after_version => BOOL
By default, the first element must immediately follow the version line.
Passing -empty_line_after_version with a true value changes this
behavior so that there must be exactly one blank line between a version line
and the first element. Example:
use Test::Changes::Strict::Simple -empty_line_after_version => 1;
-no_export => BOOL
If true, no symbols are exported.
use Test::Changes::Strict::Simple -no_export => 1;
is equivalent to:
use Test::Changes::Strict::Simple ();
This option is useful in conjunction with other import options. Example:
use Test::Changes::Strict::Simple -empty_line_after_version => 1, -no_export => 1
-version_re => REGEXP
By default, version numbers must match qr/\d+\.\d+/. This can be overridden
by passing a custom compiled regular expression via -version_re. Note that
version strings must be valid with respect to the version module.
FUNCTIONS
changes_strict_ok(NAMED_ARGUMENTS)
Runs strict validation on the given Changes file.
Named arguments:
-
changes_fileOptional. File to be validated. If no file is provided,
Changesis assumed. -
module_versionOptional. If specified, the function checks whether the highest version is equal to
module_version. This is done by comparing strings.
The function emits one test event using Test::Builder and can output
diagnostic messages if necessary.
It does not plan tests and does not call done_testing.
Returns true if all checks pass, true otherwise.
LIMITATIONS
The module expects a traditional CPAN-style Changes format:
1.23 2024-03-01
- Some change
Exotic or highly customized Changes formats may not be supported.
SEE ALSO
-
Basic structural validation of CPAN Changes files.
-
Test::CPAN::Changes::ReallyStrict
Stricter validation rules for Changes files.
-
Checks module version consistency.
-
Parser and model for Changes files.
Furthermore: Test::Builder, Time::Local, version
AUTHOR
Klaus Rindfrey, <klausrin at cpan.org.eu>
LICENSE
This software is copyright (c) 2026 by Klaus Rindfrey.
This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.