summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_unix.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 1314fca1f8..b1c0a38537 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -9,20 +9,22 @@ class TestUNIXSocket < Test::Unit::TestCase
r1, w = IO.pipe
s1, s2 = UNIXSocket.pair
begin
- s1.send_io r1
+ s1.send_io(nil)
rescue NotImplementedError
- s1.close
assert_raise(NotImplementedError) { s2.recv_io }
- return
+ rescue TypeError
+ s1.send_io(r1)
+ r2 = s2.recv_io
+ assert_equal(r1.stat.ino, r2.stat.ino)
+ assert_not_equal(r1.fileno, r2.fileno)
+ w.syswrite "a"
+ assert_equal("a", r2.sysread(10))
+ ensure
+ s1.close
+ s2.close
+ w.close
+ r1.close
+ r2.close if r2 && !r2.closed?
end
- r2 = s2.recv_io
- assert_equal(r1.stat.ino, r2.stat.ino)
- assert_not_equal(r1.fileno, r2.fileno)
- ensure
- s1.close if s1
- s2.close if s2
- r1.close if r1
- r2.close if r2
- w.close if w
end
end if defined?(UNIXSocket)