* test/ruby/test_file_exhaustive.rb: Test a file not owned.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2015-04-12 00:24:53 +00:00
parent f7dca1d7cd
commit 77ea0461c9
2 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Sun Apr 12 09:24:03 2015 Tanaka Akira <akr@fsij.org>
* test/ruby/test_file_exhaustive.rb: Test a file not owned.
Sun Apr 12 09:05:44 2015 Tanaka Akira <akr@fsij.org>
* ext/fiddle/depend: Fix "Wrong mix of special targets" error with

View File

@ -57,6 +57,16 @@ class TestFileExhaustive < Test::Unit::TestCase
@file
end
def notownedfile
return @notownedfile if defined? @notownedfile
if Process.euid != 0
@notownedfile = '/'
else
@notownedfile = nil
end
@notownedfile
end
def suidfile
return @suidfile if defined? @suidfile
if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
@ -381,9 +391,14 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_file.not_size?(nofile)
end
def test_owned_p ## xxx
def test_owned_p
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
assert_file.owned?(regular_file)
assert_file.not_owned?(notownedfile)
end
def test_grpowned_p ## xxx
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
assert_file.grpowned?(regular_file)
end
@ -1097,6 +1112,7 @@ class TestFileExhaustive < Test::Unit::TestCase
@dir,
fn1,
zerofile,
notownedfile,
suidfile,
sgidfile,
stickyfile,
@ -1329,9 +1345,14 @@ class TestFileExhaustive < Test::Unit::TestCase
assert(!(File::Stat.new(zerofile).size?))
end
def test_stat_owned_p ## xxx
def test_stat_owned_p
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
assert(File::Stat.new(regular_file).owned?)
assert(!File::Stat.new(notownedfile).owned?)
end
def test_stat_grpowned_p ## xxx
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
assert(File::Stat.new(regular_file).grpowned?)
end