Skip to content

Commit 332025b

Browse files
Add an octal prefix to clarify to be octal
Co-Authored-By: David Rodríguez <deivid.rodriguez@riseup.net>
1 parent 346a71b commit 332025b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/fileutils/test_fileutils.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def test_cp
317317
def test_cp_preserve_permissions
318318
bug4507 = '[ruby-core:35518]'
319319
touch 'tmp/cptmp'
320-
chmod 0755, 'tmp/cptmp'
320+
chmod 0o755, 'tmp/cptmp'
321321
cp 'tmp/cptmp', 'tmp/cptmp2'
322322

323323
assert_equal_filemode('tmp/cptmp', 'tmp/cptmp2', bug4507, mask: ~File.umask)
@@ -327,9 +327,9 @@ def test_cp_preserve_permissions_dir
327327
bug7246 = '[ruby-core:48603]'
328328
mkdir 'tmp/cptmp'
329329
mkdir 'tmp/cptmp/d1'
330-
chmod 0745, 'tmp/cptmp/d1'
330+
chmod 0o745, 'tmp/cptmp/d1'
331331
mkdir 'tmp/cptmp/d2'
332-
chmod 0700, 'tmp/cptmp/d2'
332+
chmod 0o700, 'tmp/cptmp/d2'
333333
cp_r 'tmp/cptmp', 'tmp/cptmp2', :preserve => true
334334
assert_equal_filemode('tmp/cptmp/d1', 'tmp/cptmp2/d1', bug7246)
335335
assert_equal_filemode('tmp/cptmp/d2', 'tmp/cptmp2/d2', bug7246)
@@ -823,7 +823,7 @@ def test_remove_entry_secure
823823
if File.sticky?('tmp/tmpdir')
824824
Dir.mkdir 'tmp/tmpdir/d', 0
825825
assert_raise(Errno::EACCES) {remove_entry_secure 'tmp/tmpdir/d'}
826-
File.chmod 0777, 'tmp/tmpdir/d'
826+
File.chmod 0o777, 'tmp/tmpdir/d'
827827
Dir.rmdir 'tmp/tmpdir/d'
828828
end
829829
end
@@ -1227,9 +1227,9 @@ def test_chmod
12271227
check_singleton :chmod
12281228

12291229
touch 'tmp/a'
1230-
chmod 0700, 'tmp/a'
1230+
chmod 0o700, 'tmp/a'
12311231
assert_filemode 0700, 'tmp/a'
1232-
chmod 0500, 'tmp/a'
1232+
chmod 0o500, 'tmp/a'
12331233
assert_filemode 0500, 'tmp/a'
12341234
end if have_file_perm?
12351235

@@ -1333,17 +1333,17 @@ def test_chmod_verbose
13331333

13341334
assert_output_lines(["chmod 700 tmp/a", "chmod 500 tmp/a"]) {
13351335
touch 'tmp/a'
1336-
chmod 0700, 'tmp/a', verbose: true
1336+
chmod 0o700, 'tmp/a', verbose: true
13371337
assert_filemode 0700, 'tmp/a', mask: 0777
1338-
chmod 0500, 'tmp/a', verbose: true
1338+
chmod 0o500, 'tmp/a', verbose: true
13391339
assert_filemode 0500, 'tmp/a', mask: 0777
13401340
}
13411341
end if have_file_perm?
13421342

13431343
def test_s_chmod_verbose
13441344
assert_output_lines(["chmod 700 tmp/a"], FileUtils) {
13451345
touch 'tmp/a'
1346-
FileUtils.chmod 0700, 'tmp/a', verbose: true
1346+
FileUtils.chmod 0o700, 'tmp/a', verbose: true
13471347
assert_filemode 0700, 'tmp/a', mask: 0777
13481348
}
13491349
end if have_file_perm?
@@ -1656,7 +1656,7 @@ def test_remove_file
16561656

16571657
def test_remove_file_file_perm
16581658
File.open('data/tmp', 'w') {|f| f.puts 'dummy' }
1659-
File.chmod 0, 'data/tmp'
1659+
File.chmod 0o000, 'data/tmp'
16601660
remove_file 'data/tmp'
16611661
assert_file_not_exist 'data/tmp'
16621662
end if have_file_perm?
@@ -1671,7 +1671,7 @@ def test_remove_dir
16711671

16721672
def test_remove_dir_file_perm
16731673
Dir.mkdir 'data/tmpdir'
1674-
File.chmod 0555, 'data/tmpdir'
1674+
File.chmod 0o555, 'data/tmpdir'
16751675
remove_dir 'data/tmpdir'
16761676
assert_file_not_exist 'data/tmpdir'
16771677
end if have_file_perm?
@@ -1790,7 +1790,7 @@ def test_rm_rf
17901790
return if /mswin|mingw/ =~ RUBY_PLATFORM
17911791

17921792
mkdir 'tmpdatadir'
1793-
chmod 700, 'tmpdatadir'
1793+
chmod 0o700, 'tmpdatadir'
17941794
rm_rf 'tmpdatadir'
17951795

17961796
assert_file_not_exist 'tmpdatadir'

0 commit comments

Comments
 (0)