]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/race: add test for issue 7561.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Mon, 21 Apr 2014 15:21:09 +0000 (17:21 +0200)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Mon, 21 Apr 2014 15:21:09 +0000 (17:21 +0200)
LGTM=dvyukov
R=rsc, iant, khr, dvyukov
CC=golang-codereviews
https://golang.org/cl/76520045

src/pkg/runtime/race/testdata/map_test.go

index 9ba74b1419c0b17025b6757e9fd4279feab755bf..98e2a5f1050b61f268df0a2489572c7c23abfb75 100644 (file)
@@ -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
+}