Test-ModuleVersion
view release on metacpan or search on metacpan
lib/Test/ModuleVersion.pm view on Meta::CPAN
plan tests => <%%%%%% test_count %%%%%%>;
EOS
# Module and version check
my $test_count = 0;
for my $m (@{$self->modules}) {
my ($module, $version) = @$m;
$code .= " # $module\n"
. " \$require_ok = require_ok('$module');\n"
. " \$version_ok = is(\$${module}::VERSION, '$version', '$module version: $version');\n"
. " push \@\$modules, ['$module' => '$version'];\n"
. " push \@\$failed, ['$module' => '$version'] unless \$require_ok && \$version_ok;\n\n";
$test_count += 2;
}
# Print module URLs
$code .= <<'EOS';
# Print module URLs
if (defined $command) {
lib/Test/ModuleVersion.pm view on Meta::CPAN
C<modules> attribute is set to the pairs of module and version.
C<test_script> method print version test into C<t/module.t> file.
Run C<mvt.pl>
$ perl mvt.pl
Test script C<t/module.t> is created.
...
$require_ok = require_ok('DBIx::Custom');
$version_ok = is($DBIx::Custom::VERSION, '0.2108', 'DBIx::Custom version: 0.2108');
$require_ok = require_ok('Validator::Custom');
$version_ok = is($Validator::Custom::VERSION, '0.1426', 'DBIx::Custom version: 0.1426');
...
=head2 Run version test
Run version test.
$ perl t/module.t
If module is not installed or version is different,
( run in 0.539 second using v1.01-cache-2.11-cpan-beeb90c9504 )