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) {
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
}
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