summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorTim Retout <tim@retout.co.uk>2012-02-17 20:17:31 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-02-18 09:40:52 +0000
commitc866c25f2646f56afa5a7ecf3a35e62bae0cdb7a (patch)
tree9c34cd7bf6875cbc1e255801f03f785383016504 /solenv
parentc5f9f099adf968c5b445d1dd7aa50f64d6495339 (diff)
Use Exporter in packager::work and add unit test.
Diffstat (limited to 'solenv')
-rw-r--r--solenv/bin/modules/packager/work.pm8
-rw-r--r--solenv/bin/modules/t/packager-work.t62
2 files changed, 70 insertions, 0 deletions
diff --git a/solenv/bin/modules/packager/work.pm b/solenv/bin/modules/packager/work.pm
index e18b6fb5127d..248183480005 100644
--- a/solenv/bin/modules/packager/work.pm
+++ b/solenv/bin/modules/packager/work.pm
@@ -28,11 +28,19 @@
package packager::work;
+use base 'Exporter';
+
use packager::exiter;
use packager::existence;
use packager::files;
use packager::globals;
+our @EXPORT_OK = qw(
+ set_global_variable
+ create_package_todos
+ execute_system_calls
+);
+
###########################################
# Setting global variables
###########################################
diff --git a/solenv/bin/modules/t/packager-work.t b/solenv/bin/modules/t/packager-work.t
new file mode 100644
index 000000000000..af1fe021b67e
--- /dev/null
+++ b/solenv/bin/modules/t/packager-work.t
@@ -0,0 +1,62 @@
+# 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 Test::More;
+
+use lib '.';
+
+BEGIN {
+ use_ok('packager::work', qw(
+ set_global_variable
+ create_package_todos
+ execute_system_calls
+ ));
+}
+
+$packager::globals::compiler = 'gcc';
+@packager::globals::logfileinfo = ();
+
+my $packagelist = <<'END';
+ # Comment
+ some_product gcc,gcc3.3 en_US,en_GB|fr_FR some_target
+ other_thing x y z
+END
+
+my @packagelist = split "\n", $packagelist;
+
+my $targets = create_package_todos( \@packagelist );
+
+is_deeply(\@packager::globals::logfileinfo,
+ ["some_target_en_US_en_GB\n",
+ "some_target_fr_FR\n"]);
+
+is_deeply($targets,
+ ["some_target_en_US_en_GB",
+ "some_target_fr_FR"]);
+
+done_testing();