summaryrefslogtreecommitdiff
path: root/libgo/go/encoding/gob/encoder_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/encoding/gob/encoder_test.go')
-rw-r--r--libgo/go/encoding/gob/encoder_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/libgo/go/encoding/gob/encoder_test.go b/libgo/go/encoding/gob/encoder_test.go
index bc5af120af3..5bc957bb370 100644
--- a/libgo/go/encoding/gob/encoder_test.go
+++ b/libgo/go/encoding/gob/encoder_test.go
@@ -662,3 +662,19 @@ func TestSequentialDecoder(t *testing.T) {
}
}
}
+
+// Should be able to have unrepresentable fields (chan, func) as long as they
+// are unexported.
+type Bug2 struct {
+ A int
+ b chan int
+}
+
+func TestUnexportedChan(t *testing.T) {
+ b := Bug2{23, make(chan int)}
+ var stream bytes.Buffer
+ enc := NewEncoder(&stream)
+ if err := enc.Encode(b); err != nil {
+ t.Fatalf("error encoding unexported channel: %s", err)
+ }
+}