diff options
author | aycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-20 11:47:45 +0000 |
---|---|---|
committer | aycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-20 11:47:45 +0000 |
commit | 39a840d084d2f24d44deb7b506ca15924fa48589 (patch) | |
tree | 8461f821f45629ea390a6beaf292fe22a8929db0 /test/ruby | |
parent | 9f5d9d31693e6f7413c22b6d7e828454e9e773b6 (diff) | |
download | ruby-39a840d084d2f24d44deb7b506ca15924fa48589.tar.gz |
Document File.{setuid?,setgid?,sticky?} support for IO objects [Bug #13972]
* file.c (rb_file_setuid_p): rdoc for IO object support
(rb_file_sgid_p): ditto (rb_file_sticky_p): ditto
* NEWS: inform users of new feature
* test/file/test_file_exhaustive.rb (io_open): wrapper for bare IO
object (test_suid): test for bare IO support (test_sgid): ditto
(test_sticky): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 817c3580d1..28a3007fe5 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -495,22 +495,39 @@ class TestFileExhaustive < Test::Unit::TestCase assert_file.grpowned?(utf8_file) end if POSIX + def io_open(file_name) + # avoid File.open since we do not want #to_path + io = IO.for_fd(IO.sysopen(file_name)) + yield io + ensure + io&.close + end + def test_suid assert_file.not_setuid?(regular_file) assert_file.not_setuid?(utf8_file) - assert_file.setuid?(suidfile) if suidfile + if suidfile + assert_file.setuid?(suidfile) + io_open(suidfile) { |io| assert_file.setuid?(io) } + end end def test_sgid assert_file.not_setgid?(regular_file) assert_file.not_setgid?(utf8_file) - assert_file.setgid?(sgidfile) if sgidfile + if sgidfile + assert_file.setgid?(sgidfile) + io_open(sgidfile) { |io| assert_file.setgid?(io) } + end end def test_sticky assert_file.not_sticky?(regular_file) assert_file.not_sticky?(utf8_file) - assert_file.sticky?(stickyfile) if stickyfile + if stickyfile + assert_file.sticky?(stickyfile) + io_open(stickyfile) { |io| assert_file.sticky?(io) } + end end def test_path_identical_p |