From 38afcc60cd3a788e6b0a4969134c87d19149bf5a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 25 Jan 2017 11:33:43 +0100 Subject: [PATCH] Bug 17986: Add tests --- t/Installer_PerlModules.t | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/t/Installer_PerlModules.t b/t/Installer_PerlModules.t index fafdd48..7301eb2 100755 --- a/t/Installer_PerlModules.t +++ b/t/Installer_PerlModules.t @@ -6,21 +6,29 @@ use strict; use warnings; -use Test::More tests => 19; +use Test::More tests => 21; BEGIN { use_ok('C4::Installer::PerlModules'); } -$C4::Installer::PerlModules::PERL_DEPS->{'Local::Module::Sort'} = { +$C4::Installer::PerlModules::PERL_DEPS->{'Local::Module::Upgraded'} = { 'required' => '1', 'min_ver' => '0.9.3', 'usage' => "Testing: make sure numbers are compared numerically and not lexicographically", }; +$Local::Module::Upgraded::VERSION = '0.9.13'; +$INC{"Local/Module/Upgraded.pm"} = 1; +use_ok("Local::Module::Upgraded"); -$Local::Module::Sort::VERSION = '0.9.13'; -$INC{"Local/Module/Sort.pm"} = 1; -use_ok("Local::Module::Sort"); +$C4::Installer::PerlModules::PERL_DEPS->{'Local::Module::NotUpgraded'} = { + 'required' => '1', + 'min_ver' => '0.9.3', + 'usage' => "Testing: make sure numbers are compared numerically and not lexicographically", +}; +$Local::Module::NotUpgraded::VERSION = '0.9.1'; +$INC{"Local/Module/NotUpgraded.pm"} = 1; +use_ok("Local::Module::NotUpgraded"); my $modules; ok ($modules = C4::Installer::PerlModules->new(), 'Tests modules object'); @@ -48,4 +56,5 @@ ok (exists($params{"DBI"}), 'DBI exists in array'); is ($modules->required('module'=>"String::Random"),1, 'String::Random should return 1 since required'); ok (!$modules->version_info(), "Testing empty modules"); -is($modules->version_info('module'=>"Local::Module::Sort")->{"Local::Module::Sort"}->{"upgrade"},0,"Version 0.9.13 is greater than 0.9.3, so no upgrade needed"); +is($modules->version_info('module'=>"Local::Module::Upgraded")->{"Local::Module::Upgraded"}->{"upgrade"},0,"Version 0.9.13 is greater than 0.9.3, so no upgrade needed"); +is($modules->version_info('module'=>"Local::Module::NotUpgraded")->{"Local::Module::NotUpgraded"}->{"upgrade"},1,"Version 0.9.1 is smaller than 0.9.1, so no upgrade needed"); -- 2.9.3