mirror of
https://github.com/golang/go
synced 2024-11-20 00:24:43 -07:00
runtime: make TestSideEffectOrder work twice
R=golang-dev, adg CC=golang-dev https://golang.org/cl/4714045
This commit is contained in:
parent
fc7b42325a
commit
29125be5c7
@ -36,7 +36,7 @@ func BenchmarkAppendSpecialCase(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var x = make([]int, 0, 10)
|
var x []int
|
||||||
|
|
||||||
func f() int {
|
func f() int {
|
||||||
x[:1][0] = 3
|
x[:1][0] = 3
|
||||||
@ -44,6 +44,7 @@ func f() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSideEffectOrder(t *testing.T) {
|
func TestSideEffectOrder(t *testing.T) {
|
||||||
|
x = make([]int, 0, 10)
|
||||||
x = append(x, 1, f())
|
x = append(x, 1, f())
|
||||||
if x[0] != 1 || x[1] != 2 {
|
if x[0] != 1 || x[1] != 2 {
|
||||||
t.Error("append failed: ", x[0], x[1])
|
t.Error("append failed: ", x[0], x[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user