[前][次][番号順一覧][スレッド一覧]

ruby-changes:38170

From: nobu <ko1@a...>
Date: Sun, 12 Apr 2015 10:22:44 +0900 (JST)
Subject: [ruby-changes:38170] nobu:r50251 (trunk): test_file_exhaustive.rb: POSIX-like tests

nobu	2015-04-12 10:22:19 +0900 (Sun, 12 Apr 2015)

  New Revision: 50251

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50251

  Log:
    test_file_exhaustive.rb: POSIX-like tests
    
    * test/ruby/test_file_exhaustive.rb: define POSIX-like filesystem
      depenedent tests only on POSIX-like systems.

  Modified files:
    trunk/test/ruby/test_file_exhaustive.rb
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 50250)
+++ test/ruby/test_file_exhaustive.rb	(revision 50251)
@@ -308,27 +308,24 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L308
   end
 
   def test_readable_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0200, regular_file)
     assert_file.not_readable?(regular_file)
     File.chmod(0600, regular_file)
     assert_file.readable?(regular_file)
     assert_file.not_readable?(nofile)
-  end
+  end if POSIX
 
   def test_readable_real_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0200, regular_file)
     assert_file.not_readable_real?(regular_file)
     File.chmod(0600, regular_file)
     assert_file.readable_real?(regular_file)
     assert_file.not_readable_real?(nofile)
-  end
+  end if POSIX
 
   def test_world_readable_p
-    return if !POSIX
     File.chmod(0006, regular_file)
     assert_file.world_readable?(regular_file)
     File.chmod(0060, regular_file)
@@ -336,30 +333,27 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L333
     File.chmod(0600, regular_file)
     assert_file.not_world_readable?(regular_file)
     assert_file.not_world_readable?(nofile)
-  end
+  end if POSIX
 
   def test_writable_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0400, regular_file)
     assert_file.not_writable?(regular_file)
     File.chmod(0600, regular_file)
     assert_file.writable?(regular_file)
     assert_file.not_writable?(nofile)
-  end
+  end if POSIX
 
   def test_writable_real_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0400, regular_file)
     assert_file.not_writable_real?(regular_file)
     File.chmod(0600, regular_file)
     assert_file.writable_real?(regular_file)
     assert_file.not_writable_real?(nofile)
-  end
+  end if POSIX
 
   def test_world_writable_p
-    return if !POSIX
     File.chmod(0006, regular_file)
     assert_file.world_writable?(regular_file)
     File.chmod(0060, regular_file)
@@ -367,25 +361,23 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L361
     File.chmod(0600, regular_file)
     assert_file.not_world_writable?(regular_file)
     assert_file.not_world_writable?(nofile)
-  end
+  end if POSIX
 
   def test_executable_p
-    return if !POSIX
     File.chmod(0100, regular_file)
     assert_file.executable?(regular_file)
     File.chmod(0600, regular_file)
     assert_file.not_executable?(regular_file)
     assert_file.not_executable?(nofile)
-  end
+  end if POSIX
 
   def test_executable_real_p
-    return if !POSIX
     File.chmod(0100, regular_file)
     assert_file.executable_real?(regular_file)
     File.chmod(0600, regular_file)
     assert_file.not_executable_real?(regular_file)
     assert_file.not_executable_real?(nofile)
-  end
+  end if POSIX
 
   def test_file_p
     assert_file.not_file?(@dir)
@@ -408,15 +400,13 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L400
   end
 
   def test_owned_p
-    return if !POSIX
     assert_file.owned?(regular_file)
     assert_file.not_owned?(notownedfile) if notownedfile
-  end
+  end if POSIX
 
   def test_grpowned_p ## xxx
-    return if !POSIX
     assert_file.grpowned?(regular_file)
-  end
+  end if POSIX
 
   def test_suid
     assert_file.not_setuid?(regular_file)
@@ -500,23 +490,21 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L490
   end
 
   def test_chmod
-    return if !POSIX
     assert_equal(1, File.chmod(0444, regular_file))
     assert_equal(0444, File.stat(regular_file).mode % 01000)
     assert_equal(0, File.open(regular_file) {|f| f.chmod(0222)})
     assert_equal(0222, File.stat(regular_file).mode % 01000)
     File.chmod(0600, regular_file)
     assert_raise(Errno::ENOENT) { File.chmod(0600, nofile) }
-  end
+  end if POSIX
 
   def test_lchmod
-    return if !POSIX
     assert_equal(1, File.lchmod(0444, regular_file))
     assert_equal(0444, File.stat(regular_file).mode % 01000)
     File.lchmod(0600, regular_file)
     assert_raise(Errno::ENOENT) { File.lchmod(0600, nofile) }
   rescue NotImplementedError
-  end
+  end if POSIX
 
   def test_chown ## xxx
   end
@@ -587,7 +575,6 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L575
   end
 
   def test_umask
-    return if !POSIX
     prev = File.umask(0777)
     assert_equal(0777, File.umask)
     open(nofile, "w") { }
@@ -595,7 +582,7 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L582
     File.unlink(nofile)
     assert_equal(0777, File.umask(prev))
     assert_raise(ArgumentError) { File.umask(0, 1, 2) }
-  end
+  end if POSIX
 
   def test_expand_path
     assert_equal(regular_file, File.expand_path(File.basename(regular_file), File.dirname(regular_file)))
@@ -1275,76 +1262,68 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L1262
   end
 
   def test_stat_readable_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0200, regular_file)
     assert(!(File::Stat.new(regular_file).readable?))
     File.chmod(0600, regular_file)
     assert(File::Stat.new(regular_file).readable?)
-  end
+  end if POSIX
 
   def test_stat_readable_real_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0200, regular_file)
     assert(!(File::Stat.new(regular_file).readable_real?))
     File.chmod(0600, regular_file)
     assert(File::Stat.new(regular_file).readable_real?)
-  end
+  end if POSIX
 
   def test_stat_world_readable_p
-    return if !POSIX
     File.chmod(0006, regular_file)
     assert(File::Stat.new(regular_file).world_readable?)
     File.chmod(0060, regular_file)
     assert(!(File::Stat.new(regular_file).world_readable?))
     File.chmod(0600, regular_file)
     assert(!(File::Stat.new(regular_file).world_readable?))
-  end
+  end if POSIX
 
   def test_stat_writable_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0400, regular_file)
     assert(!(File::Stat.new(regular_file).writable?))
     File.chmod(0600, regular_file)
     assert(File::Stat.new(regular_file).writable?)
-  end
+  end if POSIX
 
   def test_stat_writable_real_p
-    return if !POSIX
     return if Process.euid == 0
     File.chmod(0400, regular_file)
     assert(!(File::Stat.new(regular_file).writable_real?))
     File.chmod(0600, regular_file)
     assert(File::Stat.new(regular_file).writable_real?)
-  end
+  end if POSIX
 
   def test_stat_world_writable_p
-    return if !POSIX
     File.chmod(0006, regular_file)
     assert(File::Stat.new(regular_file).world_writable?)
     File.chmod(0060, regular_file)
     assert(!(File::Stat.new(regular_file).world_writable?))
     File.chmod(0600, regular_file)
     assert(!(File::Stat.new(regular_file).world_writable?))
-  end
+  end if POSIX
 
   def test_stat_executable_p
-    return if !POSIX
     File.chmod(0100, regular_file)
     assert(File::Stat.new(regular_file).executable?)
     File.chmod(0600, regular_file)
     assert(!(File::Stat.new(regular_file).executable?))
-  end
+  end if POSIX
 
   def test_stat_executable_real_p
-    return if !POSIX
     File.chmod(0100, regular_file)
     assert(File::Stat.new(regular_file).executable_real?)
     File.chmod(0600, regular_file)
     assert(!(File::Stat.new(regular_file).executable_real?))
-  end
+  end if POSIX
 
   def test_stat_file_p
     assert(!(File::Stat.new(@dir).file?))
@@ -1364,15 +1343,13 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L1343
   end
 
   def test_stat_owned_p
-    return if !POSIX
     assert(File::Stat.new(regular_file).owned?)
     assert(!File::Stat.new(notownedfile).owned?) if notownedfile
-  end
+  end if POSIX
 
   def test_stat_grpowned_p ## xxx
-    return if !POSIX
     assert(File::Stat.new(regular_file).grpowned?)
-  end
+  end if POSIX
 
   def test_stat_suid
     assert(!(File::Stat.new(regular_file).setuid?))

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]