aboutsummaryrefslogtreecommitdiff
path: root/t/test.t
diff options
context:
space:
mode:
Diffstat (limited to 't/test.t')
-rwxr-xr-xt/test.t60
1 files changed, 53 insertions, 7 deletions
diff --git a/t/test.t b/t/test.t
index daa9d1c..ae9e94c 100755
--- a/t/test.t
+++ b/t/test.t
@@ -53,10 +53,10 @@ move("$sbo_home/SLACKBUILDS.TXT.moved", "$sbo_home/SLACKBUILDS.TXT");
# slackbuilds_or_fetch test
is(slackbuilds_or_fetch, 1, 'slackbuilds_or_fetch is good');
-# get_installed_sbos test
-print "pseudo-random sampling of get_installed_sbos output...\n";
+# get_installed_packages 'SBO' test
+print "pseudo-random sampling of get_installed_packages 'SBO' output...\n";
$SBO::Lib::pkg_db = "$pwd/packages";
-my $installed = get_installed_sbos;
+my $installed = get_installed_packages 'SBO';
for my $key (keys @$installed) {
is($$installed[$key]{version}, '1.13') if $$installed[$key]{name} eq
'OpenAL';
@@ -70,8 +70,36 @@ for my $key (keys @$installed) {
'unetbootin';
is($$installed[$key]{version}, '2.6.0') if $$installed[$key]{name} eq
'zdoom';
+ is($$installed[$key]{version}, '9.20.1') if $$installed[$key]{name} eq
+ 'p7zip-compat32';
+ is($$installed[$key]{version}, '3.99.5') if $$installed[$key]{name} eq
+ 'lame-compat32';
}
-print "completed pseudo-random testing of get_installed_sbos \n";
+print "completed pseudo-random testing of get_installed_packages 'SBO' \n";
+
+# get_installed_packages 'ALL' test
+print "pseudo-random sampling of get_installed_packages 'ALL' output...\n";
+$SBO::Lib::pkg_db = "$pwd/packages";
+$installed = get_installed_packages 'ALL';
+for my $key (keys @$installed) {
+ is($$installed[$key]{version}, '1.13') if $$installed[$key]{name} eq
+ 'OpenAL';
+ is($$installed[$key]{version}, '2.8.2') if $$installed[$key]{name} eq
+ 'gimp';
+ is($$installed[$key]{version}, '4.1.3') if $$installed[$key]{name} eq
+ 'libdvdnav';
+ is($$installed[$key]{version}, '5.16.1') if $$installed[$key]{name} eq
+ 'perl';
+ is($$installed[$key]{version}, '575') if $$installed[$key]{name} eq
+ 'unetbootin';
+ is($$installed[$key]{version}, '1.2.6') if $$installed[$key]{name} eq
+ 'zlib';
+ is($$installed[$key]{version}, '9.20.1') if $$installed[$key]{name} eq
+ 'p7zip-compat32';
+ is($$installed[$key]{version}, '3.99.5') if $$installed[$key]{name} eq
+ 'lame-compat32';
+}
+print "completed pseudo-random testing of get_installed_packages 'ALL' \n";
# get_sbo_location tests
is(get_sbo_location ('nginx'), "$sbo_home/network/nginx",
@@ -174,9 +202,27 @@ print {$tempfh} "$lmt/COPYING\n";
print {$tempfh} "$lmt/Documentation/\n";
print {$tempfh} "$lmt/README\n";
print {$tempfh} "Slackware package skype-2.2.0.35-i486-1_SBo.tgz created.\n";
-is(get_src_dir $tempfh, 'laptop-mode-tools_1.60', 'get_src_dir good');
is(get_pkg_name $tempfh, 'skype-2.2.0.35-i486-1_SBo.tgz', 'get_pkg_name good');
-close $tempfh;
+
+# we can not test get_src_dir() at present - we will need to support $TMP in
+# order to be able to test this. because user can't write to /tmp/SBo
+#close $tempfh;
+#$tempfh = tempfile(DIR => $tempdir);
+#opendir (my $tsbo_dh, '/tmp/SBo');
+#FIRST: while (readdir $tsbo_dh) {
+# next FIRST if /^\.[\.]{0,1}$/;
+# say {$tempfh} $_;
+#}
+#close $tsbo_dh;
+#mkdir '/tmp/SBo/test.d.1';
+#mkdir '/tmp/SBo/test.2.d';
+#my $src = get_src_dir $tempfh;
+#say ref $src;
+#say $_ for @$src;
+#is($$src[0], 'test.d.1', 'get_src_dir test 01');
+#is($$src[1], 'test.2.d', 'get_src_dir test 02');
+#rmdir '/tmp/SBo/test.d.1';
+#rmdir '/tmp/SBo/test.2.d';
# check_distfiles test
%downloads = get_sbo_downloads(LOCATION => "$sbo_home/perl/perl-Sort-Versions");
@@ -294,7 +340,7 @@ for my $found (@$findings) {
}
# get_inst_names test
-$installed = get_installed_sbos;
+$installed = get_installed_packages 'SBO';
my $inst_names = get_inst_names $installed;
ok('zdoom' ~~ @$inst_names, 'get_inst_names is good');