1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Assert obsolete method warnings in IPAddr

This commit is contained in:
Nobuyoshi Nakada 2019-07-01 13:01:31 +09:00
parent fe03bbaf34
commit 6982a9049e
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -121,14 +121,20 @@ class TC_IPAddr < Test::Unit::TestCase
assert_equal("::192.168.1.2", a.to_s)
assert_equal("0000:0000:0000:0000:0000:0000:c0a8:0102", a.to_string)
assert_equal(Socket::AF_INET6, a.family)
assert_equal(true, a.ipv4_compat?)
assert_warning(/obsolete/) {
assert_predicate(a, :ipv4_compat?)
}
b = a.native
assert_equal("192.168.1.2", b.to_s)
assert_equal(Socket::AF_INET, b.family)
assert_equal(false, b.ipv4_compat?)
assert_warning(/obsolete/) {
assert_not_predicate(b, :ipv4_compat?)
}
a = IPAddr.new("192.168.1.2")
b = a.ipv4_compat
assert_warning(/obsolete/) {
b = a.ipv4_compat
}
assert_equal("::192.168.1.2", b.to_s)
assert_equal(Socket::AF_INET6, b.family)
end