[ruby/fileutils] Add an octal prefix to clarify to be octal

https://github.com/ruby/fileutils/commit/332025bc02

Co-Authored-By: David Rodríguez <deivid.rodriguez@riseup.net>
This commit is contained in:
Nobuyoshi Nakada 2022-07-19 16:50:00 +09:00 committed by git
parent d084585f01
commit ee1d2b276a

View File

@ -317,7 +317,7 @@ class TestFileUtils < Test::Unit::TestCase
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)
@ -327,9 +327,9 @@ class TestFileUtils < Test::Unit::TestCase
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)
@ -823,7 +823,7 @@ class TestFileUtils < Test::Unit::TestCase
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
@ -1227,9 +1227,9 @@ class TestFileUtils < Test::Unit::TestCase
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?
@ -1333,9 +1333,9 @@ class TestFileUtils < Test::Unit::TestCase
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?
@ -1343,7 +1343,7 @@ class TestFileUtils < Test::Unit::TestCase
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?
@ -1656,7 +1656,7 @@ class TestFileUtils < Test::Unit::TestCase
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?
@ -1671,7 +1671,7 @@ class TestFileUtils < Test::Unit::TestCase
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?
@ -1790,7 +1790,7 @@ cd -
return if /mswin|mingw/ =~ RUBY_PLATFORM
mkdir 'tmpdatadir'
chmod 700, 'tmpdatadir'
chmod 0o700, 'tmpdatadir'
rm_rf 'tmpdatadir'
assert_file_not_exist 'tmpdatadir'