Skip to content

Commit e190638

Browse files
tklausergopherbot
authored andcommitted
net/netip: cover more AddrPort.String cases in tests
TestInvalidAddrPortString currently only tests for invalid AddrPorts. Add some valid cases as well to improve test coverage. Change-Id: Iaa9192e48a61daed6f7ce7d680d602a021570bdc Reviewed-on: https://go-review.googlesource.com/c/go/+/613795 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Tobias Klauser <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent db40d1a commit e190638

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/net/netip/netip_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -2179,11 +2179,14 @@ func TestPrefixString(t *testing.T) {
21792179
}
21802180
}
21812181

2182-
func TestInvalidAddrPortString(t *testing.T) {
2182+
func TestAddrPortString(t *testing.T) {
21832183
tests := []struct {
21842184
ipp AddrPort
21852185
want string
21862186
}{
2187+
{MustParseAddrPort("127.0.0.1:80"), "127.0.0.1:80"},
2188+
{MustParseAddrPort("[0000::0]:8080"), "[::]:8080"},
2189+
{MustParseAddrPort("[FFFF::1]:8080"), "[ffff::1]:8080"},
21872190
{AddrPort{}, "invalid AddrPort"},
21882191
{AddrPortFrom(Addr{}, 80), "invalid AddrPort"},
21892192
}

0 commit comments

Comments
 (0)