aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-08-29 00:14:53 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-08-29 00:17:57 +0200
commitd9948975a7bc93871b252aa9c5ac9f513e6f13d4 (patch)
treeb68fced461fc0a198888bc4ba21d4b619c02d900 /t
parent6e8187c0a64c138149868c867ea6e4ddafed5c87 (diff)
downloadsbotools-d9948975a7bc93871b252aa9c5ac9f513e6f13d4.tar.xz
SBO::Lib::Readme: let get_readme_contents use slurp() too
Diffstat (limited to 't')
-rwxr-xr-xt/01-unit.t13
-rwxr-xr-xt/02.1-unit-args.t6
-rwxr-xr-xt/07-fail.t6
3 files changed, 12 insertions, 13 deletions
diff --git a/t/01-unit.t b/t/01-unit.t
index 3e973aa..13d6e8e 100755
--- a/t/01-unit.t
+++ b/t/01-unit.t
@@ -11,7 +11,7 @@ use Capture::Tiny qw/ capture_merged /;
use File::Temp 'tempdir';
use Cwd;
-plan tests => 61;
+plan tests => 60;
# 1-2: test script_error();
{
@@ -277,14 +277,13 @@ SKIP: {
is (scalar @{ SBO::Lib::get_src_dir($fh) }, 0, "get_src_dir() returned an empty array ref");
}
-# 49-50: test get_readme_contents();
+# 49: test get_readme_contents();
{
my @ret = get_readme_contents(undef);
is ($ret[0], undef, "get_readme_contents() returned undef");
- is ($ret[1], 6, "get_readme_contents() returned 6");
}
-# 51-52: test user_prompt();
+# 50-51: test user_prompt();
{
my $exit;
my $out = capture_merged { $exit = exit_code { user_prompt('foo', undef); }; };
@@ -293,7 +292,7 @@ SKIP: {
is ($out, "Unable to locate foo in the SlackBuilds.org tree.\n", 'user_prompt() gave correct output');
}
-# 53-55: test perform_sbo();
+# 52-54: test perform_sbo();
SKIP: {
skip 'Tests invalid if /foo exists.', 3 if -e "/foo";
@@ -304,7 +303,7 @@ SKIP: {
is ($res[2], 6, 'perform_sbo returned correct exit');
}
-# 56-60: test version_cmp();
+# 55-59: test version_cmp();
{
chomp(my $kv = `uname -r`);
$kv =~ s/-/_/g;
@@ -322,7 +321,7 @@ SKIP: {
is (SBO::Lib::version_cmp('1.0', '1.0_foo_bar'), 0, "version_cmp(1.0, 1.0_foo_bar) returned 0");
}
-# 61: test check_multilib();
+# 60: test check_multilib();
{
my $file = "/etc/profile.d/32dev.sh";
diff --git a/t/02.1-unit-args.t b/t/02.1-unit-args.t
index bb70939..8b74fd4 100755
--- a/t/02.1-unit-args.t
+++ b/t/02.1-unit-args.t
@@ -11,7 +11,7 @@ use lib "$RealBin/../SBO-Lib/lib";
use SBO::Lib;
use Capture::Tiny qw/ capture_merged /;
-plan tests => 60;
+plan tests => 59;
sub test_args {
my $sub = shift;
@@ -34,8 +34,8 @@ test_args $_ for qw/
get_filename_from_link verify_distfile get_distfile get_symlink_from_filename
check_x32 rewrite_slackbuild revert_slackbuild check_distfiles create_symlinks
get_src_dir get_tmp_extfn perform_sbo do_convertpkg do_slackbuild make_clean
- make_distclean do_upgradepkg get_build_queue merge_queues get_readme_contents
- get_user_group ask_user_group get_opts ask_opts user_prompt
+ make_distclean do_upgradepkg get_build_queue merge_queues get_user_group
+ ask_user_group get_opts ask_opts user_prompt
/;
test_args 'get_from_info', LOCATION => 1;
diff --git a/t/07-fail.t b/t/07-fail.t
index 38569ed..507be68 100755
--- a/t/07-fail.t
+++ b/t/07-fail.t
@@ -129,7 +129,7 @@ sboinstall 'malformed-info2', { input => "y\ny\nn", expected => qr!Failures:\n
sboinstall 'malformed-info3', { exit => 2, expected => "A fatal script error has occurred:\nerror when parsing malformed-info3.info file. Line: FAIL\nExiting.\n" };
# 14: Malformed slackbuild - no readme
-sboinstall 'malformed-readme', { expected => "A fatal script error has occurred:\nopen_fh, $RealBin/LO-fail/malformed-readme/README is not a file\nExiting.\n", exit => 2 };
+sboinstall 'malformed-readme', { expected => "Could not open README for malformed-readme.\n", exit => 1 };
# 15: Malformed slackbuild - no .SlackBuild
sboinstall 'malformed-slackbuild',
@@ -175,7 +175,7 @@ sboinstall qw/ -r failingslackbuild /, { expected => qr/Failures:\n failingslac
# 22-24: Slackbuild with %README% req without a readme
sboinstall qw/ -r noreadmebutreadmereq /;
-sboremove qw/ noreadmebutreadmereq /, { input => 'y', expected => qr/fatal script error.*open_fh/s, exit => 2 };
+sboremove qw/ noreadmebutreadmereq /, { input => "y\nn", expected => qr/Unable to open README for noreadmebutreadmereq[.]/s, exit => 0 };
sboremove qw/ noreadmebutreadmereq /, { input => "n\ny\ny", expected => qr/Display README.*Remove noreadme.*Added to remove queue.*Removing 1 pack.*noreadme.*All operations/s, exit => 0 };
# 25: compat32 should fail for a perl sbo
@@ -203,7 +203,7 @@ SKIP: {
skip "No /etc/profile.d/32dev.sh", 1 unless -e "/etc/profile.d/32dev.sh";
skip "No /usr/sbin/convertpkg-compat32", 1 unless -e "/usr/sbin/convertpkg-compat32";
- sboinstall qw/ -p malformed-readme /, { exit => 2, expected => qr!A fatal script error has occurred:\nopen_fh, .*t/LO-fail/malformed-readme/README is not a file! };
+ sboinstall qw/ -p malformed-readme /, { exit => 1, expected => qr!Could not open README for malformed-readme[.]! };
}
# 27: sboupgrade with -r and -z