summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/gob/gobencdec_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/encoding/gob/gobencdec_test.go')
-rw-r--r--src/pkg/encoding/gob/gobencdec_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/encoding/gob/gobencdec_test.go b/src/pkg/encoding/gob/gobencdec_test.go
index 301551db4..0193e2b67 100644
--- a/src/pkg/encoding/gob/gobencdec_test.go
+++ b/src/pkg/encoding/gob/gobencdec_test.go
@@ -11,6 +11,7 @@ import (
"errors"
"fmt"
"io"
+ "net"
"strings"
"testing"
"time"
@@ -767,3 +768,17 @@ func TestGobEncodePtrError(t *testing.T) {
t.Fatalf("expected nil, got %v", err2)
}
}
+
+func TestNetIP(t *testing.T) {
+ // Encoding of net.IP{1,2,3,4} in Go 1.1.
+ enc := []byte{0x07, 0x0a, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04}
+
+ var ip net.IP
+ err := NewDecoder(bytes.NewReader(enc)).Decode(&ip)
+ if err != nil {
+ t.Fatalf("decode: %v", err)
+ }
+ if ip.String() != "1.2.3.4" {
+ t.Errorf("decoded to %v, want 1.2.3.4", ip.String())
+ }
+}