ruby-changes:38165
From: akr <ko1@a...>
Date: Sun, 12 Apr 2015 09:25:12 +0900 (JST)
Subject: [ruby-changes:38165] akr:r50246 (trunk): * test/ruby/test_file_exhaustive.rb: Test a file not owned.
akr 2015-04-12 09:24:53 +0900 (Sun, 12 Apr 2015) New Revision: 50246 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50246 Log: * test/ruby/test_file_exhaustive.rb: Test a file not owned. Modified files: trunk/ChangeLog trunk/test/ruby/test_file_exhaustive.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 50245) +++ ChangeLog (revision 50246) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Apr 12 09:24:03 2015 Tanaka Akira <akr@f...> + + * test/ruby/test_file_exhaustive.rb: Test a file not owned. + Sun Apr 12 09:05:44 2015 Tanaka Akira <akr@f...> * ext/fiddle/depend: Fix "Wrong mix of special targets" error with Index: test/ruby/test_file_exhaustive.rb =================================================================== --- test/ruby/test_file_exhaustive.rb (revision 50245) +++ test/ruby/test_file_exhaustive.rb (revision 50246) @@ -57,6 +57,16 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L57 @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::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L391 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::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L1112 @dir, fn1, zerofile, + notownedfile, suidfile, sgidfile, stickyfile, @@ -1329,9 +1345,14 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L1345 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/