Skip to content

Commit

Permalink
Add an octal prefix to clarify to be octal
Browse files Browse the repository at this point in the history
Co-Authored-By: David Rodríguez <[email protected]>
  • Loading branch information
nobu and deivid-rodriguez committed Jul 19, 2022
1 parent 346a71b commit 332025b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/fileutils/test_fileutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def test_cp
def test_cp_preserve_permissions
bug4507 = '[ruby-core:35518]'
touch 'tmp/cptmp'
chmod 0755, 'tmp/cptmp'
chmod 0o755, 'tmp/cptmp'
cp 'tmp/cptmp', 'tmp/cptmp2'

assert_equal_filemode('tmp/cptmp', 'tmp/cptmp2', bug4507, mask: ~File.umask)
Expand All @@ -327,9 +327,9 @@ def test_cp_preserve_permissions_dir
bug7246 = '[ruby-core:48603]'
mkdir 'tmp/cptmp'
mkdir 'tmp/cptmp/d1'
chmod 0745, 'tmp/cptmp/d1'
chmod 0o745, 'tmp/cptmp/d1'
mkdir 'tmp/cptmp/d2'
chmod 0700, 'tmp/cptmp/d2'
chmod 0o700, 'tmp/cptmp/d2'
cp_r 'tmp/cptmp', 'tmp/cptmp2', :preserve => true
assert_equal_filemode('tmp/cptmp/d1', 'tmp/cptmp2/d1', bug7246)
assert_equal_filemode('tmp/cptmp/d2', 'tmp/cptmp2/d2', bug7246)
Expand Down Expand Up @@ -823,7 +823,7 @@ def test_remove_entry_secure
if File.sticky?('tmp/tmpdir')
Dir.mkdir 'tmp/tmpdir/d', 0
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
File.chmod 0777, 'tmp/tmpdir/d'
File.chmod 0o777, 'tmp/tmpdir/d'
Dir.rmdir 'tmp/tmpdir/d'
end
end
Expand Down Expand Up @@ -1227,9 +1227,9 @@ def test_chmod
check_singleton :chmod

touch 'tmp/a'
chmod 0700, 'tmp/a'
chmod 0o700, 'tmp/a'
assert_filemode 0700, 'tmp/a'
chmod 0500, 'tmp/a'
chmod 0o500, 'tmp/a'
assert_filemode 0500, 'tmp/a'
end if have_file_perm?

Expand Down Expand Up @@ -1333,17 +1333,17 @@ def test_chmod_verbose

assert_output_lines(["chmod 700 tmp/a", "chmod 500 tmp/a"]) {
touch 'tmp/a'
chmod 0700, 'tmp/a', verbose: true
chmod 0o700, 'tmp/a', verbose: true
assert_filemode 0700, 'tmp/a', mask: 0777
chmod 0500, 'tmp/a', verbose: true
chmod 0o500, 'tmp/a', verbose: true
assert_filemode 0500, 'tmp/a', mask: 0777
}
end if have_file_perm?

def test_s_chmod_verbose
assert_output_lines(["chmod 700 tmp/a"], FileUtils) {
touch 'tmp/a'
FileUtils.chmod 0700, 'tmp/a', verbose: true
FileUtils.chmod 0o700, 'tmp/a', verbose: true
assert_filemode 0700, 'tmp/a', mask: 0777
}
end if have_file_perm?
Expand Down Expand Up @@ -1656,7 +1656,7 @@ def test_remove_file

def test_remove_file_file_perm
File.open('data/tmp', 'w') {|f| f.puts 'dummy' }
File.chmod 0, 'data/tmp'
File.chmod 0o000, 'data/tmp'
remove_file 'data/tmp'
assert_file_not_exist 'data/tmp'
end if have_file_perm?
Expand All @@ -1671,7 +1671,7 @@ def test_remove_dir

def test_remove_dir_file_perm
Dir.mkdir 'data/tmpdir'
File.chmod 0555, 'data/tmpdir'
File.chmod 0o555, 'data/tmpdir'
remove_dir 'data/tmpdir'
assert_file_not_exist 'data/tmpdir'
end if have_file_perm?
Expand Down Expand Up @@ -1790,7 +1790,7 @@ def test_rm_rf
return if /mswin|mingw/ =~ RUBY_PLATFORM

mkdir 'tmpdatadir'
chmod 700, 'tmpdatadir'
chmod 0o700, 'tmpdatadir'
rm_rf 'tmpdatadir'

assert_file_not_exist 'tmpdatadir'
Expand Down

0 comments on commit 332025b

Please sign in to comment.