diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2018-02-14 14:06:14 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2018-02-14 14:06:14 +0100 |
commit | a090d49ae630cf95b923d8a4f979eff0b7a66cb8 (patch) | |
tree | 135b0fa797bf7ed81cf4e916d0aa0d1a35a7a5f2 | |
parent | e2fa49af4780b36e842d93e45adaadce9e929592 (diff) | |
download | sbotools-a090d49ae630cf95b923d8a4f979eff0b7a66cb8.tar.xz |
SBO::App: Fix package name and method lookup
-rwxr-xr-x | SBO-Lib/lib/SBO/App.pm | 4 | ||||
-rwxr-xr-x | SBO-Lib/lib/SBO/App/Remove.pm | 1 | ||||
-rwxr-xr-x | SBO-Lib/lib/SBO/App/Snap.pm | 5 | ||||
-rwxr-xr-x | t/05-upgrade.t | 14 |
4 files changed, 13 insertions, 11 deletions
diff --git a/SBO-Lib/lib/SBO/App.pm b/SBO-Lib/lib/SBO/App.pm index 7033d93..3e600fe 100755 --- a/SBO-Lib/lib/SBO/App.pm +++ b/SBO-Lib/lib/SBO/App.pm @@ -1,4 +1,4 @@ -package SBO::App::Remove; +package SBO::App; # vim: ts=2:et # @@ -15,7 +15,7 @@ use File::Basename; sub new { my $class = shift; - my $self = _parse_opts(@_); + my $self = $class->_parse_opts(@_); $self->{fname} = basename( (caller(0))[1] ); return bless $self, $class; diff --git a/SBO-Lib/lib/SBO/App/Remove.pm b/SBO-Lib/lib/SBO/App/Remove.pm index a660035..cc3d303 100755 --- a/SBO-Lib/lib/SBO/App/Remove.pm +++ b/SBO-Lib/lib/SBO/App/Remove.pm @@ -16,6 +16,7 @@ use Getopt::Long qw(GetOptionsFromArray :config bundling); use parent 'SBO::App'; sub _parse_opts { + my $class = shift; my @ARGS = @_; my ($help, $vers, $non_int, $alwaysask); diff --git a/SBO-Lib/lib/SBO/App/Snap.pm b/SBO-Lib/lib/SBO/App/Snap.pm index a00f977..f065a4c 100755 --- a/SBO-Lib/lib/SBO/App/Snap.pm +++ b/SBO-Lib/lib/SBO/App/Snap.pm @@ -1,5 +1,5 @@ -#!/usr/bin/perl -# +package SBO::App::Snap; + # vim: ts=2:et # # sbosnap @@ -19,6 +19,7 @@ use Getopt::Long qw/ GetOptionsFromArray /; use parent 'SBO::App'; sub _parse_opts { + my $class = shift; my @ARGS = @_; my ($help, $vers); diff --git a/t/05-upgrade.t b/t/05-upgrade.t index e35bc5c..44037c6 100755 --- a/t/05-upgrade.t +++ b/t/05-upgrade.t @@ -11,7 +11,7 @@ use Test::Sbotools qw/ make_slackbuilds_txt set_lo sboconfig sboinstall sboupgra use File::Temp 'tempdir'; if ($ENV{TEST_INSTALL}) { - plan tests => 20; + plan tests => 21; } else { plan skip_all => 'Only run these tests if TEST_INSTALL=1'; } @@ -116,13 +116,13 @@ sboupgrade 'nonexistentslackbuild4', { input => "y\ny", expected => qr/Proceed w install( 'LO3', 'nonexistentslackbuild5', 'nonexistentslackbuild4' ); sboupgrade qw/ -f nonexistentslackbuild4 /, { input => "y\ny\ny", expected => qr/Proceed with nonexistentslackbuild5\b.*Proceed with nonexistentslackbuild4\b.*Upgrade queue: nonexistentslackbuild5 nonexistentslackbuild4\n/s }; -# 13-15: sboupgrade --all +# 13-16: sbosnap + sboupgrade --all my $temp = tempdir(CLEANUP => 1); set_repo("file://$temp"); capture_merged { system <<"END"; }; cd $temp; git init; END -sbosnap 'fetch', { test => 0 }; +sbosnap 'fetch', { expected => qr/Pulling SlackBuilds tree[.][.][.]/ }; install( 'LO2', 'nonexistentslackbuild' ); my @sbos = glob("/var/log/packages/*_SBo"); sboupgrade '--all', { input => ("n\n" x (@sbos+1)), expected => qr/Proceed with nonexistentslackbuild\b/ }; @@ -133,19 +133,19 @@ sboupgrade '--all', { expected => "Checking for updated SlackBuilds...\nNothing cleanup(); -# 16: sboupgrade --all shouldn't pick up weird-versionsbo or locale-versionsbo +# 17: sboupgrade --all shouldn't pick up weird-versionsbo or locale-versionsbo install('LO', 'weird-versionsbo', 'locale-versionsbo'); sboupgrade '--all', { input => ("n\n" x (@sbos+1)), expected => sub { not /weird-versionsbo/ and not /locale-versionsbo/ } }; -# 17-18: sboupgrade -r -f both something installed and something not installed +# 18-19: sboupgrade -r -f both something installed and something not installed install('LO', 'nonexistentslackbuild'); sboupgrade qw/ -r -f nonexistentslackbuild /, { expected => qr/^Upgrade queue: nonexistentslackbuild$/m }; sboupgrade qw/ -r -f nonexistentslackbuild2 /, { expected => "" }; -# 19: sboupgrade -r on something already up to date +# 20: sboupgrade -r on something already up to date sboupgrade qw/ -r nonexistentslackbuild /, { expected => "" }; -# 20: sboupgrade and answer weirdly and use a default and then answer no twice +# 21: sboupgrade and answer weirdly and use a default and then answer no twice install('LO2', 'nonexistentslackbuild', 'nonexistentslackbuild5'); sboupgrade qw/nonexistentslackbuild nonexistentslackbuild5/, { input => "foo\n\nn\nn\n", expected => qr/Proceed with nonexistentslackbuild\?.*Proceed with nonexistentslackbuild\?.*Proceed with nonexistentslackbuild5\?.*Upgrade queue: nonexistentslackbuild$/sm }; |