go.net/ipv6: add missing API tests
Now the package has a code coverage of 76.1% of statements.
Also fixes flaky concurrent test.
Fixes golang/go#5696.
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/45620043
diff --git a/ipv6/icmp_test.go b/ipv6/icmp_test.go
index a7833dd..4005036 100644
--- a/ipv6/icmp_test.go
+++ b/ipv6/icmp_test.go
@@ -14,6 +14,24 @@
"testing"
)
+var icmpStringTests = []struct {
+ in ipv6.ICMPType
+ out string
+}{
+ {ipv6.ICMPTypeDestinationUnreachable, "destination unreachable"},
+
+ {256, "<nil>"},
+}
+
+func TestICMPString(t *testing.T) {
+ for _, tt := range icmpStringTests {
+ s := tt.in.String()
+ if s != tt.out {
+ t.Errorf("got %s; expected %s", s, tt.out)
+ }
+ }
+}
+
func TestICMPFilter(t *testing.T) {
switch runtime.GOOS {
case "plan9", "windows":