summaryrefslogtreecommitdiff
path: root/test/resolv/test_dns.rb
diff options
context:
space:
mode:
authorTanaka Akira <akr@fsij.org>2019-07-30 11:59:54 +0900
committerTanaka Akira <akr@fsij.org>2019-07-30 11:59:54 +0900
commit1da3a31a5f0211db121e0df4ca456838a437537f (patch)
treee29315ea2ba9471ae4edd5fa05b1ff489c527b6c /test/resolv/test_dns.rb
parent6eab49a40abcc743ddffcd5fc7103acbea06b215 (diff)
Use lowercase letters for IPv6 addresses.
Reported by chucke (Tiago Cardoso). Patch by jeremyevans0 (Jeremy Evans). [Bug #14612]
Diffstat (limited to 'test/resolv/test_dns.rb')
-rw-r--r--test/resolv/test_dns.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb
index fe1ab6c..d69bec8 100644
--- a/test/resolv/test_dns.rb
+++ b/test/resolv/test_dns.rb
@@ -216,6 +216,22 @@ class TestResolvDNS < Test::Unit::TestCase
assert_instance_of Resolv::IPv6, Resolv::IPv6.create('::1:127.0.0.1'), ref
end
+ def test_ipv6_to_s
+ test_cases = [
+ ["2001::abcd:abcd:abcd", "2001::ABcd:abcd:ABCD"],
+ ["2001:db8::1", "2001:db8::0:1"],
+ ["::", "0:0:0:0:0:0:0:0"],
+ ["2001::", "2001::0"],
+ ["2001:db8::1:1:1:1:1", "2001:db8:0:1:1:1:1:1"],
+ ["1::1:0:0:0:1", "1:0:0:1:0:0:0:1"],
+ ["1::1:0:0:1", "1:0:0:0:1:0:0:1"],
+ ]
+
+ test_cases.each do |expected, ipv6|
+ assert_equal expected, Resolv::IPv6.create(ipv6).to_s
+ end
+ end
+
def test_ipv6_should_be_16
ref = '[rubygems:1626]'