Skip to content

Commit

Permalink
Assert obsolete method warnings in IPAddr
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and hsbt committed Jul 29, 2021
1 parent a79c3ff commit 94c3391
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/test_ipaddr.rb
Expand Up @@ -153,14 +153,20 @@ def test_ipv4_compat
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
Expand Down

0 comments on commit 94c3391

Please sign in to comment.