From 6709d0b78d9cbbe8a05fc8e6cd2144a39ca57b88 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Thu, 7 Jun 2018 15:05:22 +0300 Subject: [PATCH] Added IPv6 specific test for resolveTAddress. --- tests/testaddress.nim | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/testaddress.nim b/tests/testaddress.nim index d2f9a275..d0ef0060 100644 --- a/tests/testaddress.nim +++ b/tests/testaddress.nim @@ -47,7 +47,8 @@ when isMainModule: ] var hostnames = [ "www.google.com:443", - "www.github.com:443" + "www.github.com:443", + "localhost:443" ] for item in numeric: var taseq = resolveTAddress(item) @@ -75,7 +76,8 @@ when isMainModule: ] var hostnames = [ "www.google.com", - "www.github.com" + "www.github.com", + "localhost" ] for item in numeric4: var taseq = resolveTAddress(item, Port(443)) @@ -90,3 +92,23 @@ when isMainModule: for item in hostnames: var taseq = resolveTAddress(item, Port(443)) check len(taseq) >= 1 + + test "resolveTAddress(string) (IPv6 only)": + var hostnames = [ + "www.google.com:443", + "www.github.com:443", + "localhost:443" + ] + for item in hostnames: + var taseq = resolveTAddress(item, IpAddressFamily.IPv6) + check len(taseq) >= 1 + + test "resolveTAddress(string, Port) (IPv6 only)": + var hostnames = [ + "www.google.com", + "www.github.com", + "localhost" + ] + for item in hostnames: + var taseq = resolveTAddress(item, Port(443), IpAddressFamily.IPv6) + check len(taseq) >= 1