summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-10 10:52:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-10 10:52:29 +0000
commit0ad3abe1f10d5e8134c1956d84c432e2b0fc3304 (patch)
treed3da59700005e6ca601211abd8fd929ac62ff0c8 /test
parentadabc801be4a6536c786ea5c6c858ba71a186336 (diff)
* test/ruby/test_file_exhaustive.rb: Test socket.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index b2c3e34371..e1881b69f6 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -1,6 +1,7 @@
require "test/unit"
require "fileutils"
require "tmpdir"
+require "socket"
class TestFileExhaustive < Test::Unit::TestCase
DRIVE = Dir.pwd[%r'\A(?:[a-z]:|//[^/]+/[^/]+)'i]
@@ -167,10 +168,16 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_file.not_symlink?(@nofile)
end
- def test_socket_p ## xxx
+ def test_socket_p
assert_file.not_socket?(@dir)
assert_file.not_socket?(@file)
assert_file.not_socket?(@nofile)
+ if defined? UNIXServer
+ socket = make_tmp_filename("socket")
+ UNIXServer.open(socket) {|sock|
+ assert_file.socket?(socket)
+ }
+ end
end
def test_blockdev_p ## xxx
@@ -995,7 +1002,11 @@ class TestFileExhaustive < Test::Unit::TestCase
fifo = make_tmp_filename("fifo")
make_fifo fifo
end
- [@dir, @file, @zerofile, @symlinkfile, @hardlinkfile, fifo].compact.each do |f|
+ if defined? UNIXServer
+ socket = make_tmp_filename("socket")
+ UNIXServer.open(socket).close
+ end
+ [@dir, @file, @zerofile, @symlinkfile, @hardlinkfile, fifo, socket].compact.each do |f|
assert_equal(File.atime(f), test(?A, f))
assert_equal(File.ctime(f), test(?C, f))
assert_equal(File.mtime(f), test(?M, f))
@@ -1114,9 +1125,15 @@ class TestFileExhaustive < Test::Unit::TestCase
assert(!(File::Stat.new(@hardlinkfile).symlink?)) if @hardlinkfile
end
- def test_stat_socket_p ## xxx
+ def test_stat_socket_p
assert(!(File::Stat.new(@dir).socket?))
assert(!(File::Stat.new(@file).socket?))
+ if defined? UNIXServer
+ socket = make_tmp_filename("socket")
+ UNIXServer.open(socket) {|sock|
+ assert(File::Stat.new(socket).socket?)
+ }
+ end
end
def test_stat_blockdev_p ## xxx