reg/vendor/github.com/gogo/protobuf/test/stdtypes/concurrency_test.go
Jess Frazelle 3834c605e5
update deps
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-03-06 10:32:47 -05:00

32 lines
529 B
Go

package stdtypes
import (
"io/ioutil"
"sync"
"testing"
"github.com/gogo/protobuf/proto"
)
func TestConcurrentTextMarshal(t *testing.T) {
// Verify that there are no race conditions when calling
// TextMarshaler.Marshal on a protobuf message that contains a StdDuration
std := StdTypes{}
var wg sync.WaitGroup
tm := proto.TextMarshaler{}
for i := 0; i < 2; i++ {
wg.Add(1)
go func() {
defer wg.Done()
err := tm.Marshal(ioutil.Discard, &std)
if err != nil {
t.Fatal(err)
}
}()
}
wg.Wait()
}