Skip to content

Commit bb10efe

Browse files
committed
Added test_install_mode_option
1 parent ba3bd6f commit bb10efe

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/fileutils/test_fileutils.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,30 @@ 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+
end if have_file_perm?
1186+
11631187
def test_chmod
11641188
check_singleton :chmod
11651189

0 commit comments

Comments
 (0)