Bug #1170 ยป test_file_exhaustive.rb.diff
test_file_exhaustive.rb 2009-02-18 10:26:24.000000000 +0100 | ||
---|---|---|
end
|
||
def test_exist_p
|
||
assert(File.exist?(@dir))
|
||
assert(File.exist?(@file))
|
||
assert(!(File.exist?(@nofile)))
|
||
end
|
||
def test_readable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0200, @file)
|
||
assert(!(File.readable?(@file)))
|
||
File.chmod(0600, @file)
|
||
assert(File.readable?(@file))
|
||
assert(!(File.readable?(@nofile)))
|
||
end
|
||
def test_readable_real_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0200, @file)
|
||
assert(!(File.readable_real?(@file)))
|
||
File.chmod(0600, @file)
|
||
assert(File.readable_real?(@file))
|
||
assert(!(File.readable_real?(@nofile)))
|
||
end
|
||
def test_world_readable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
File.chmod(0006, @file)
|
||
assert(File.world_readable?(@file))
|
||
File.chmod(0060, @file)
|
||
assert(!(File.world_readable?(@file)))
|
||
File.chmod(0600, @file)
|
||
assert(!(File.world_readable?(@file)))
|
||
assert(!(File.world_readable?(@nofile)))
|
||
end
|
||
def test_writable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0400, @file)
|
||
assert(!(File.writable?(@file)))
|
||
File.chmod(0600, @file)
|
||
assert(File.writable?(@file))
|
||
assert(!(File.writable?(@nofile)))
|
||
end
|
||
def test_writable_real_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0400, @file)
|
||
assert(!(File.writable_real?(@file)))
|
||
File.chmod(0600, @file)
|
||
assert(File.writable_real?(@file))
|
||
assert(!(File.writable_real?(@nofile)))
|
||
end
|
||
def test_world_writable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
File.chmod(0006, @file)
|
||
... | ... | |
assert(!(File::Stat.new(@file).blockdev?))
|
||
end
|
||
def test_stat_chardev_p ## xxx
|
||
assert(!(File::Stat.new(@dir).chardev?))
|
||
assert(!(File::Stat.new(@file).chardev?))
|
||
end
|
||
def test_stat_readable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0200, @file)
|
||
assert(!(File::Stat.new(@file).readable?))
|
||
File.chmod(0600, @file)
|
||
assert(File::Stat.new(@file).readable?)
|
||
end
|
||
def test_stat_readable_real_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0200, @file)
|
||
assert(!(File::Stat.new(@file).readable_real?))
|
||
File.chmod(0600, @file)
|
||
assert(File::Stat.new(@file).readable_real?)
|
||
end
|
||
def test_stat_world_readable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
File.chmod(0006, @file)
|
||
assert(File::Stat.new(@file).world_readable?)
|
||
File.chmod(0060, @file)
|
||
assert(!(File::Stat.new(@file).world_readable?))
|
||
File.chmod(0600, @file)
|
||
assert(!(File::Stat.new(@file).world_readable?))
|
||
end
|
||
def test_stat_writable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0400, @file)
|
||
assert(!(File::Stat.new(@file).writable?))
|
||
File.chmod(0600, @file)
|
||
assert(File::Stat.new(@file).writable?)
|
||
end
|
||
def test_stat_writable_real_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
return if Process.euid == 0
|
||
File.chmod(0400, @file)
|
||
assert(!(File::Stat.new(@file).writable_real?))
|
||
File.chmod(0600, @file)
|
||
assert(File::Stat.new(@file).writable_real?)
|
||
end
|
||
def test_stat_world_writable_p
|
||
return if /cygwin|mswin|bccwin|mingw|emx/ =~ RUBY_PLATFORM
|
||
File.chmod(0006, @file)
|
||
assert(File::Stat.new(@file).world_writable?)
|