Commit aa97c88e authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

encoding/gob: add test case for issue 4214.

See http://code.google.com/p/go/issues/detail?id=4214

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6619068
parent e855fcc3
......@@ -5,6 +5,7 @@
package gob
import (
"bytes"
"reflect"
"testing"
)
......@@ -192,3 +193,30 @@ func TestRegistrationNaming(t *testing.T) {
}
}
}
func TestStressParallel(t *testing.T) {
type T2 struct{ A int }
c := make(chan bool)
const N = 10
for i := 0; i < N; i++ {
go func() {
p := new(T2)
Register(p)
b := new(bytes.Buffer)
enc := NewEncoder(b)
err := enc.Encode(p)
if err != nil {
t.Error("encoder fail:", err)
}
dec := NewDecoder(b)
err = dec.Decode(p)
if err != nil {
t.Error("decoder fail:", err)
}
c <- true
}()
}
for i := 0; i < N; i++ {
<-c
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment