1Test::Version(3) User Contributed Perl Documentation Test::Version(3)
2
3
4
6 Test::Version - Check to see that version's in modules are sane
7
9 version 2.09
10
12 use Test::More;
13 use Test::Version 1.001001 qw( version_all_ok ), {
14 is_strict => 0,
15 has_version => 1,
16 consistent => 1,
17 };
18
19 # test blib or lib by default
20 version_all_ok();
21
22 done_testing;
23
25 This module's goal is to be a one stop shop for checking to see that
26 your versions across your dist are sane. Please ensure that you use
27 version 0.04 or later only, as earlier versions are old code and may
28 not work correctly. Current feature list:
29
30 module has a version
31 Tests to insure that all modules checked have a VERSION defined,
32 Can replace Test::HasVersion
33
34 module has a valid version
35 Tests to insure that all versions are valid, according to the rules
36 of version method "is_lax". To quote:
37
38 The lax criteria corresponds to what is currently allowed by the
39 version parser. All of the following formats are acceptable for
40 dotted-decimal formats strings:
41
42 v1.2
43 1.2345.6
44 v1.23_4
45 1.2345
46 1.2345_01
47
48 If you want to limit yourself to a much more narrow definition of
49 what a version string constitutes, is_strict() is limited to
50 version strings like the following list:
51
52 v1.234.5
53 2.3456
54
55 you can cause your tests to fail if not strict by setting is_strict
56 to 1
57
59 version_ok
60 version_ok( $filename, [ $name ] );
61
62 Test a single ".pm" file by passing a path to the function. Checks if
63 the module has a version, and that it is valid with "is_lax".
64
65 version_all_ok
66 version_all_ok( [ $directory, [ $name ]] );
67
68 Test all modules in a directory with "version_ok". By default it will
69 check "blib" or "lib" if you haven't passed it a directory.
70
72 has_version
73 use Test::Version qw( version_all_ok ), { has_version => 0 };
74
75 Allows disabling whether a module has to have a version. If set to 0
76 version tests will be skipped in any module where no version is found.
77
78 really doesn't make sense to use with just version_ok
79
80 is_strict
81 use Test::Version { is_strict => 1 };
82
83 this allows enabling of versions "is_strict" checks to ensure that your
84 version is strict.
85
86 consistent
87 use Test::Version { consistent => 1 };
88
89 Check if every module has the same version number.
90
91 ignore_unindexable
92 use Test::Version { ignore_unindexable => 0};
93
94 if you have at least Module::Metadata v1.000020 Test::Version will by
95 default skip any files not considered is_indexable
96
97 filename_match
98 use Test::Version 2.0 { filename_match => [qr{Foo/Bar.pm$}] };
99
100 Only test files that match the given pattern. Pattern may be a list of
101 strings, regular expressions or code references. The filename will
102 match if it matches one or more patterns.
103
104 string
105 The file matches if it matches the pattern string exactly.
106
107 regular expression
108 The file matches if it matches the regular expression.
109
110 code reference
111 The file matches if the code reference returns a true value. The
112 filename is passed in as the only argument to the code reference.
113
114 multiple
115 use Test::Version 2.02 { multiple => 1 };
116
117 Test each version for each package if multiple packages are found in a
118 file.
119
121 The goal is to have the functionality of all of these.
122
123 Test::HasVersion
124 Test::ConsistentVersion
125 Test::GreaterVersion
126
127 If you are using Dist::Zilla there is a plugin
128
129 Dist::Zilla::Plugin::Test::Version
130
132 Please report any bugs or feature requests on the bugtracker website
133 <https://github.com/plicease/test-version/issues>
134
135 When submitting a bug or request, please include a test-file or a patch
136 to an existing test-file that illustrates the bug or desired feature.
137
139 • Damyan Ivanov <dmn@debian.org>
140
141 • Dave Rolsky <autarch@urth.org>
142
143 • Gabor Szabo <gabor@szabgab.com>
144
145 • Karen Etheridge <ether@cpan.org>
146
147 • Michael G. Schwern <schwern@pobox.com>
148
149 • Mike Doherty <doherty@cs.dal.ca>
150
151 • particle <particle@cpan.org>
152
154 • Graham Ollis <plicease@cpan.org>
155
156 • Caleb Cushing <xenoterracide@gmail.com>
157
159 This software is Copyright (c) 2018 by Caleb Cushing.
160
161 This is free software, licensed under:
162
163 The Artistic License 2.0 (GPL Compatible)
164
165
166
167perl v5.38.0 2023-07-21 Test::Version(3)