summaryrefslogtreecommitdiffstats
path: root/t/superuser--should-restart.t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-18 09:12:33 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-18 09:12:33 +0000
commit3ef994375ad4c50369e151e0ccae7725b74bfea6 (patch)
tree9805db920ebad836969859a439be6942fc0411b0 /t/superuser--should-restart.t
parent2d334b04228f9ac254b21816567e45a6e08fe9d4 (diff)
downloadurpmi-3ef994375ad4c50369e151e0ccae7725b74bfea6.tar
urpmi-3ef994375ad4c50369e151e0ccae7725b74bfea6.tar.gz
urpmi-3ef994375ad4c50369e151e0ccae7725b74bfea6.tar.bz2
urpmi-3ef994375ad4c50369e151e0ccae7725b74bfea6.tar.xz
urpmi-3ef994375ad4c50369e151e0ccae7725b74bfea6.zip
add a test for "should-restart"
Diffstat (limited to 't/superuser--should-restart.t')
-rw-r--r--t/superuser--should-restart.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/superuser--should-restart.t b/t/superuser--should-restart.t
new file mode 100644
index 00000000..a8729712
--- /dev/null
+++ b/t/superuser--should-restart.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+# "a" provides "should-restart = system"
+# "c" provides "should-restart = system"
+#
+use strict;
+use lib '.', 't';
+use helper;
+use Test::More 'no_plan';
+
+need_root_and_prepare();
+
+my $medium_name = 'should-restart';
+
+urpmi_addmedia("$medium_name $::pwd/media/$medium_name");
+
+test_urpmi('a', 'You should restart system for a');
+test_urpmi('b', '');
+test_urpmi('c', 'You should restart system for a, c');
+
+sub test_urpmi {
+ my ($para, $wanted) = @_;
+ my $s = run_urpm_cmd("urpmi $para");
+ print $s;
+
+ my $msg = $s =~ /^(You should restart .*)/m ? $1 : '';
+
+ ok($msg eq $wanted, "wanted:$wanted, got:$msg");
+}