Improves IPV6 examples

This commit is contained in:
Mickael Remond 2019-06-26 14:00:39 +02:00
parent 1c792e61c6
commit f79a3a219b
No known key found for this signature in database
GPG key ID: E6F6045D79965AA3

View file

@ -17,11 +17,11 @@ func TestParseAddr(t *testing.T) {
{name: "ipv4-with-port-1", input: "localhost:5555", want: "localhost:5555"}, {name: "ipv4-with-port-1", input: "localhost:5555", want: "localhost:5555"},
{name: "ipv4-no-port-2", input: "127.0.0.1", want: "127.0.0.1:5222"}, {name: "ipv4-no-port-2", input: "127.0.0.1", want: "127.0.0.1:5222"},
{name: "ipv4-with-port-2", input: "127.0.0.1:5555", want: "127.0.0.1:5555"}, {name: "ipv4-with-port-2", input: "127.0.0.1:5555", want: "127.0.0.1:5555"},
{name: "ipv6-no-port-1", input: "1::", want: "[1::]:5222"}, {name: "ipv6-no-port-1", input: "::1", want: "[::1]:5222"},
{name: "ipv6-no-port-2", input: "[1::]", want: "[1::]:5222"}, {name: "ipv6-no-port-2", input: "[::1]", want: "[::1]:5222"},
{name: "ipv6-no-port-3", input: "1::2008", want: "[1::2008]:5222"}, {name: "ipv6-no-port-3", input: "2001::7334", want: "[2001::7334]:5222"},
{name: "ipv6-no-port-4", input: "1::2008:1", want: "[1::2008:1]:5222"}, {name: "ipv6-no-port-4", input: "2001:db8:85a3:0:0:8a2e:370:7334", want: "[2001:db8:85a3:0:0:8a2e:370:7334]:5222"},
{name: "ipv6-with-port-1", input: "[1::]:5555", want: "[1::]:5555"}, {name: "ipv6-with-port-1", input: "[::1]:5555", want: "[::1]:5555"},
} }
for _, tc := range tests { for _, tc := range tests {
t.Run(tc.name, func(st *testing.T) { t.Run(tc.name, func(st *testing.T) {