Commit 1332eb5b authored by Rémy Oudompheng's avatar Rémy Oudompheng

runtime/race: add test for issue 7561.

LGTM=dvyukov
R=rsc, iant, khr, dvyukov
CC=golang-codereviews
https://golang.org/cl/76520045
parent 296eeaa7
...@@ -198,6 +198,7 @@ func TestRaceMapDeletePartKey(t *testing.T) { ...@@ -198,6 +198,7 @@ func TestRaceMapDeletePartKey(t *testing.T) {
delete(m, *k) delete(m, *k)
<-ch <-ch
} }
func TestRaceMapInsertPartKey(t *testing.T) { func TestRaceMapInsertPartKey(t *testing.T) {
k := &Big{} k := &Big{}
m := make(map[Big]bool) m := make(map[Big]bool)
...@@ -209,6 +210,7 @@ func TestRaceMapInsertPartKey(t *testing.T) { ...@@ -209,6 +210,7 @@ func TestRaceMapInsertPartKey(t *testing.T) {
m[*k] = true m[*k] = true
<-ch <-ch
} }
func TestRaceMapInsertPartVal(t *testing.T) { func TestRaceMapInsertPartVal(t *testing.T) {
v := &Big{} v := &Big{}
m := make(map[int]Big) m := make(map[int]Big)
...@@ -220,3 +222,19 @@ func TestRaceMapInsertPartVal(t *testing.T) { ...@@ -220,3 +222,19 @@ func TestRaceMapInsertPartVal(t *testing.T) {
m[1] = *v m[1] = *v
<-ch <-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
}
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