blob: b602cc15d23745127098a13fadb30cae91090600 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
assert('Socket.gethostname') do
assert_true(Socket.gethostname.is_a? String)
end
assert('Socket::getaddrinfo') do
ret = Socket.getaddrinfo("localhost", "domain", Socket::AF_INET, Socket::SOCK_DGRAM)
assert_true ret.size >= 1
a = ret[0]
assert_equal "AF_INET", a[0]
assert_equal 53, a[1]
# documents says it's a hostname but CRuby returns an address
#assert_equal "127.0.0.1", a[2]
assert_equal "127.0.0.1", a[3]
assert_equal Socket::AF_INET, a[4]
assert_equal Socket::SOCK_DGRAM, a[5]
assert_equal Socket::IPPROTO_UDP, a[6]
end
|