@@ -1160,6 +1160,32 @@ def test_install_group_option
11601160 }
11611161 end
11621162
1163+ def test_install_mode_option
1164+ File . open ( 'tmp/a' , 'w' ) { |f | f . puts 'aaa' }
1165+ install 'tmp/a' , 'tmp/b' , :mode => "u=wrx,g=rx,o=x"
1166+ assert_filemode 0751 , 'tmp/b'
1167+ install 'tmp/b' , 'tmp/c' , :mode => "g+w-x"
1168+ assert_filemode 0761 , 'tmp/c'
1169+ install 'tmp/c' , 'tmp/d' , :mode => "o+r,g=o+w,o-r,u-o" # 761 => 763 => 773 => 771 => 671
1170+ assert_filemode 0671 , 'tmp/d'
1171+ install 'tmp/d' , 'tmp/e' , :mode => "go=u"
1172+ assert_filemode 0666 , 'tmp/e'
1173+ install 'tmp/e' , 'tmp/f' , :mode => "u=wrx,g=,o="
1174+ assert_filemode 0700 , 'tmp/f'
1175+ install 'tmp/f' , 'tmp/g' , :mode => "u=rx,go="
1176+ assert_filemode 0500 , 'tmp/g'
1177+ install 'tmp/g' , 'tmp/h' , :mode => "+wrx"
1178+ assert_filemode 0777 , 'tmp/h'
1179+ install 'tmp/h' , 'tmp/i' , :mode => "u+s,o=s"
1180+ assert_filemode 04770 , 'tmp/i'
1181+ install 'tmp/i' , 'tmp/j' , :mode => "u-w,go-wrx"
1182+ assert_filemode 04500 , 'tmp/j'
1183+ install 'tmp/j' , 'tmp/k' , :mode => "+s"
1184+ assert_filemode 06500 , 'tmp/k'
1185+ install 'tmp/a' , 'tmp/l' , :mode => "o+X"
1186+ assert_filemode 0644 , 'tmp/l'
1187+ end if have_file_perm?
1188+
11631189 def test_chmod
11641190 check_singleton :chmod
11651191
0 commit comments