From 332025bc0299254f97a06d64e580f60fea4e7125 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 19 Jul 2022 16:50:00 +0900 Subject: [PATCH] Add an octal prefix to clarify to be octal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: David Rodríguez --- test/fileutils/test_fileutils.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 36b5d6e..e1e2a82 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -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) @@ -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) @@ -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 @@ -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? @@ -1333,9 +1333,9 @@ 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? @@ -1343,7 +1343,7 @@ def test_chmod_verbose 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 @@ 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? @@ -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? @@ -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'