diff options
Diffstat (limited to 'libgo/go/mime/multipart/writer_test.go')
-rw-r--r-- | libgo/go/mime/multipart/writer_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libgo/go/mime/multipart/writer_test.go b/libgo/go/mime/multipart/writer_test.go index 52d68bcb68c..ba00c97ecee 100644 --- a/libgo/go/mime/multipart/writer_test.go +++ b/libgo/go/mime/multipart/writer_test.go @@ -111,3 +111,18 @@ func TestWriterSetBoundary(t *testing.T) { t.Errorf("expected my-separator in output. got: %q", got) } } + +func TestWriterBoundaryGoroutines(t *testing.T) { + // Verify there's no data race accessing any lazy boundary if it's used by + // different goroutines. This was previously broken by + // https://codereview.appspot.com/95760043/ and reverted in + // https://codereview.appspot.com/117600043/ + w := NewWriter(ioutil.Discard) + done := make(chan int) + go func() { + w.CreateFormField("foo") + done <- 1 + }() + w.Boundary() + <-done +} |