Test::RequiredMinimumDependencyVersion - Require a minimum version for your dependencies
Version 0.002
use Test::RequiredMinimumDependencyVersion; Test::RequiredMinimumDependencyVersion->new(module => { ... })->all_files_ok;
There are some modules where you'll always depend on a minimal version, either because of a bug or because of an API change. A good example would be Test::More where version 0.88 introduced done_testing() or version which strongly urges to set 0.77 as a minimum in your code.
done_testing()
This test can be used to check that, whenever you use these modules, you also declare the minimum version.
This test is an author test and should not run on end-user installations. Recommendation is to put it into your xt instead of your t directory.
Returns a new Test::RequiredMinimumDependencyVersion instance. new takes a hash with its arguments.
Test::RequiredMinimumDependencyVersion
new
Test::RequiredMinimumDependencyVersion->new( module => { 'Test::More' => '0.88', }, );
The following arguments are supported:
The module argument is a hash ref where the keys are the modules you want to enforce and the minimal version is its value.
module
This will run a test for parsing the file with Perl::PrereqScanner and another test for every module you specified if it is used in this file. It is therefore unlikely to know the exact number of tests that will run in advance. Use done_testing from Test::More if you call this test directly instead of a plan.
done_testing
plan
file_ok returns something true if all checked dependencies are at least of the required minimal version and false otherwise.
file_ok
Checks all the files under @entries by calling file_ok on every file. Directories are recursive searched for files. Everything not a file and not a directory (e.g. a symlink) is ignored. It calls done_testing or skip_all so you can't have already called plan.
@entries
skip_all
If @entries is empty default directories are searched for files. The default directories are blib, or lib if it doesn't exist, bin and script.
all_files_ok returns something true if all files test ok and false otherwise.
all_files_ok
Check all files in the bin, script and lib directory.
use 5.006; use strict; use warnings; use Test::RequiredMinimumDependencyVersion; Test::RequiredMinimumDependencyVersion->new( module => { 'version' => '0.77', }, )->all_files_ok;
use 5.006; use strict; use warnings; use Test::RequiredMinimumDependencyVersion; Test::RequiredMinimumDependencyVersion->new( module => { 'Test::More' => '0.88', 'version' => '0.77', }, )->all_files_ok(qw(bin lib t xt corpus/hello_world.pl));
use 5.006; use strict; use warnings; use Test::More 0.88; use Test::RequiredMinimumDependencyVersion; my $trmdv = Test::RequiredMinimumDependencyVersion->new( module => { 'Test::More' => '0.88', }, ); $trmdv->file_ok('t/00-load.t'); $trmdv->file_ok('xt/author/pod-links.t'); done_testing();
Test::More
Please report any bugs or feature requests through the issue tracker at https://github.com/skirmess/Test-RequiredMinimumDependencyVersion/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/skirmess/Test-RequiredMinimumDependencyVersion
git clone https://github.com/skirmess/Test-RequiredMinimumDependencyVersion.git
Sven Kirmess <sven.kirmess@kzone.ch>
This software is Copyright (c) 2018 by Sven Kirmess.
This is free software, licensed under:
The (two-clause) FreeBSD License
To install Test::RequiredMinimumDependencyVersion, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::RequiredMinimumDependencyVersion
CPAN shell
perl -MCPAN -e shell install Test::RequiredMinimumDependencyVersion
For more information on module installation, please visit the detailed CPAN module installation guide.