blob: 22eee783dda0d105d76562f9cb14db1a7d31aedf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
begin
require "socket"
require "test/unit"
rescue LoadError
end
class TestUDPSocket < Test::Unit::TestCase
def test_connect # [ruby-dev:25045]
s = UDPSocket.new
host = Object.new
class << host; self end.funcall(:define_method, :to_str) {
s.close
"127.0.0.1"
}
assert_raise(IOError) {
s.connect(host, 1)
}
end
def test_bind # [ruby-dev:25057]
s = UDPSocket.new
host = Object.new
class << host; self end.funcall(:define_method, :to_str) {
s.close
"127.0.0.1"
}
assert_raise(IOError) {
s.bind(host, 2000)
}
end
end if defined?(UDPSocket)
|