diff options
author | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2014-04-21 17:21:09 +0200 |
---|---|---|
committer | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2014-04-21 17:21:09 +0200 |
commit | 9b439d9d2089774ef9633b08d932023f1fb7bf03 (patch) | |
tree | 034d411ecc24b928101359739f0773911dcc063a | |
parent | 052a21c12af590122d6186029f9af02427487dc3 (diff) | |
download | go-9b439d9d2089774ef9633b08d932023f1fb7bf03.tar.gz |
runtime/race: add test for issue 7561.
LGTM=dvyukov
R=rsc, iant, khr, dvyukov
CC=golang-codereviews
https://codereview.appspot.com/76520045
-rw-r--r-- | src/pkg/runtime/race/testdata/map_test.go | 18 |
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 9ba74b141..98e2a5f10 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 +} |