summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorTim Retout <tim@retout.co.uk>2012-02-23 20:11:50 +0000
committerTim Retout <tim.retout@smoothwall.net>2012-03-14 21:57:33 +0000
commit712e7b813825ec9fb1d0c1fcdbfcea2f44274e69 (patch)
tree9043310bdc4c937ea8469d190fdeab9f9af60267 /solenv
parent230854bad461dbfa2aa72269c2468ff380b789a8 (diff)
Unit test and correction for remove_multiple_modules_packages
Diffstat (limited to 'solenv')
-rw-r--r--solenv/bin/modules/installer/packagelist.pm2
-rw-r--r--solenv/bin/modules/t/installer-packagelist.t57
2 files changed, 58 insertions, 1 deletions
diff --git a/solenv/bin/modules/installer/packagelist.pm b/solenv/bin/modules/installer/packagelist.pm
index d6b2f02afa5d..e39917cebe39 100644
--- a/solenv/bin/modules/installer/packagelist.pm
+++ b/solenv/bin/modules/installer/packagelist.pm
@@ -214,7 +214,7 @@ sub remove_multiple_modules_packages
# modules will only be removed from packages, that have more modules
# than the compare package
- if ( $packagecount <= $comparepackagecount ) { next; } # nothing to do, take next package
+ if ( $packagecount < $comparepackagecount ) { next; } # nothing to do, take next package
# iterating over all modules of this package
diff --git a/solenv/bin/modules/t/installer-packagelist.t b/solenv/bin/modules/t/installer-packagelist.t
new file mode 100644
index 000000000000..b4ef6cead5fb
--- /dev/null
+++ b/solenv/bin/modules/t/installer-packagelist.t
@@ -0,0 +1,57 @@
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# [ Copyright (C) 2012 Tim Retout <tim@retout.co.uk> (initial developer) ]
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+use strict;
+use warnings;
+
+use lib '.';
+
+use Test::More;
+
+BEGIN {
+ use_ok('installer::packagelist');
+}
+
+my @packagemodules = (
+ { allmodules => [qw(a b c d)] },
+ { allmodules => [qw(a b c)] },
+ { allmodules => [qw(e f g)] },
+ { allmodules => [qw(h)] },
+ { allmodules => [qw(a b g)] },
+);
+
+my @expected_packagemodules = (
+ { allmodules => [qw(d)] },
+ { allmodules => [qw(c)] },
+ { allmodules => [qw(e f)] },
+ { allmodules => [qw(h)] },
+ { allmodules => [qw(a b g)] },
+);
+
+installer::packagelist::remove_multiple_modules_packages(\@packagemodules);
+
+is_deeply(\@packagemodules, \@expected_packagemodules);
+
+done_testing();