diff options
Diffstat (limited to 't/superuser--orphans.t')
-rw-r--r-- | t/superuser--orphans.t | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/t/superuser--orphans.t b/t/superuser--orphans.t index 53c0c210..e43874ce 100644 --- a/t/superuser--orphans.t +++ b/t/superuser--orphans.t @@ -31,7 +31,6 @@ use Test::More 'no_plan'; need_root_and_prepare(); - my $name = 'orphans'; urpmi_addmedia("$name-1 $::pwd/media/$name-1"); urpmi_addmedia("$name-2 $::pwd/media/$name-2"); @@ -39,6 +38,7 @@ urpmi_addmedia("$name-2 $::pwd/media/$name-2"); # we want urpmi --auto-select to always check orphans (when not using --auto-orphans) set_urpmi_cfg_global_options({ 'nb-of-new-unrequested-pkgs-between-auto-select-orphans-check' => 0 }); + test_urpme_v1(['h'], 'h', ''); test_urpme_v1(['hh', 'h'], 'h', 'hh'); @@ -67,6 +67,11 @@ test_auto_select(['r', 'rr1'], 'r rr1 rr2', 'r-2 rr1-1', 'rr2-1'); test_urpme(['g'], 'g', 'g', ''); test_urpme(['gg', 'g'], 'g', 'g', 'gg-2'); +test_unorphan_v1('u1', 'u2'); +test_unorphan_v2('u1', 'u2'); +test_unorphan_v3('u1', 'u2'); + + sub add_version1 { map { "$_-1-1" } split(' ', $_[0] || '') } sub add_version2 { map { "$_-2-1" } split(' ', $_[0] || '') } sub add_release { map { "$_-1" } split(' ', $_[0] || '') } @@ -157,6 +162,35 @@ sub test_urpme_v1 { reset_unrequested_list(); } +sub test_unorphan_v1 { + my ($pkg1, $pkg2) = @_; + print "# test_unorphan_v1($pkg1, $pkg2)\n"; + urpmi("--media $name-1 --auto $pkg1"); + urpmi("--media $name-1 --auto $pkg2"); + urpme("--auto --auto-orphans $pkg1"); + check_installed_and_remove($pkg2); +} + +sub test_unorphan_v2 { + my ($pkg1, $pkg2) = @_; + print "# test_unorphan_v2($pkg1, $pkg2)\n"; + urpmi("--media $name-1 --auto $pkg1"); + urpme("--auto $pkg1"); + urpmi("--media $name-1 --auto $pkg2"); + urpme("--auto --auto-orphans"); + check_installed_and_remove($pkg2); +} + +sub test_unorphan_v3 { + my ($pkg1, $pkg2) = @_; + print "# test_unorphan_v3($pkg1, $pkg2)\n"; + urpmi("--media $name-1 --auto $pkg1"); + check_installed_and_remove($pkg2, $pkg1); + urpmi("--media $name-1 --auto $pkg2"); + urpme("--auto --auto-orphans"); + check_installed_and_remove($pkg2); +} + sub run_and_get_suggested_orphans { my ($cmd, @wanted) = @_; my $s = run_urpm_cmd($cmd); |