summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Tartière <romain@blogreen.org>2016-03-19 11:30:36 +0100
committerRomain Tartière <romain@blogreen.org>2016-03-19 11:30:36 +0100
commitc9831237b01eb672e1f59cf607a9a57bbcd61476 (patch)
tree8fed9a2189c2e8e76f55fb20b3aa5d1fa9fcb65c
parent064502c6a943f983cabea38fccdb528ad9469aec (diff)
downloadipaddress-c9831237b01eb672e1f59cf607a9a57bbcd61476.tar.gz
Highlight bug: eql? is not aliased to the overridden ==.
~~~ IPAddress.parse('::1') == IPAddress.parse('::1') #=> true IPAddress.parse('::1').eql? IPAddress.parse('::1') #=> false ~~~
-rw-r--r--test/ipaddress/ipv4_test.rb2
-rw-r--r--test/ipaddress/ipv6_test.rb5
2 files changed, 7 insertions, 0 deletions
diff --git a/test/ipaddress/ipv4_test.rb b/test/ipaddress/ipv4_test.rb
index 19264e2..3fc808b 100644
--- a/test/ipaddress/ipv4_test.rb
+++ b/test/ipaddress/ipv4_test.rb
@@ -361,8 +361,10 @@ class IPv4Test < Minitest::Test
assert_equal false, ip3 < ip1
# ip1 should be equal to itself
assert_equal true, ip1 == ip1
+ assert_equal true, ip1.eql?(ip1)
# ip1 should be equal to ip4
assert_equal true, ip1 == ip4
+ assert_equal true, ip1.eql?(ip4)
# test sorting
arr = ["10.1.1.1/8","10.1.1.1/16","172.16.1.1/14"]
assert_equal arr, [ip1,ip2,ip3].sort.map{|s| s.to_string}
diff --git a/test/ipaddress/ipv6_test.rb b/test/ipaddress/ipv6_test.rb
index dcfb601..a1cd072 100644
--- a/test/ipaddress/ipv6_test.rb
+++ b/test/ipaddress/ipv6_test.rb
@@ -247,6 +247,11 @@ class IPv6Test < Minitest::Test
assert_equal false, ip3 < ip1
# ip1 should be equal to itself
assert_equal true, ip1 == ip1
+ assert_equal true, ip1.eql?(ip1)
+ # ip1 should be equal to a copy of itself
+ other = ip1.dup
+ assert_equal true, ip1 == other
+ assert_equal true, ip1.eql?(other)
# ip4 should be greater than ip1
assert_equal true, ip1 < ip4
assert_equal false, ip1 > ip4