aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Oudompheng <oudomphe@phare.normalesup.org>2014-04-21 17:21:09 +0200
committerRémy Oudompheng <oudomphe@phare.normalesup.org>2014-04-21 17:21:09 +0200
commit1332eb5b6210e16601ff8d049885e41a6e16908d (patch)
treeb504b5b2692846a85b412c800960cf110f177104
parent296eeaa78df8537964821756c393cbd06174a119 (diff)
downloadgo-1332eb5b6210e16601ff8d049885e41a6e16908d.tar.gz
go-1332eb5b6210e16601ff8d049885e41a6e16908d.zip
runtime/race: add test for issue 7561.
LGTM=dvyukov R=rsc, iant, khr, dvyukov CC=golang-codereviews https://golang.org/cl/76520045
-rw-r--r--src/pkg/runtime/race/testdata/map_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pkg/runtime/race/testdata/map_test.go b/src/pkg/runtime/race/testdata/map_test.go
index 9ba74b1419..98e2a5f105 100644
--- a/src/pkg/runtime/race/testdata/map_test.go
+++ b/src/pkg/runtime/race/testdata/map_test.go
@@ -198,6 +198,7 @@ func TestRaceMapDeletePartKey(t *testing.T) {
delete(m, *k)
<-ch
}
+
func TestRaceMapInsertPartKey(t *testing.T) {
k := &Big{}
m := make(map[Big]bool)
@@ -209,6 +210,7 @@ func TestRaceMapInsertPartKey(t *testing.T) {
m[*k] = true
<-ch
}
+
func TestRaceMapInsertPartVal(t *testing.T) {
v := &Big{}
m := make(map[int]Big)
@@ -220,3 +222,19 @@ func TestRaceMapInsertPartVal(t *testing.T) {
m[1] = *v
<-ch
}
+
+// Test for issue 7561.
+func TestRaceMapAssignMultipleReturn(t *testing.T) {
+ connect := func() (int, error) { return 42, nil }
+ conns := make(map[int][]int)
+ conns[1] = []int{0}
+ ch := make(chan bool, 1)
+ var err error
+ go func() {
+ conns[1][0], err = connect()
+ ch <- true
+ }()
+ x := conns[1][0]
+ _ = x
+ <-ch
+}