diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 25 |
2 files changed, 27 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Sun Apr 12 09:24:03 2015 Tanaka Akira <[email protected]> + + * test/ruby/test_file_exhaustive.rb: Test a file not owned. + Sun Apr 12 09:05:44 2015 Tanaka Akira <[email protected]> * ext/fiddle/depend: Fix "Wrong mix of special targets" error with diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 20bc37990a..c2e41e32ba 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -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 |