Skip to content

Commit 7a0dc1c

Browse files
test: match gccgo error strings.
R=golang-dev, iant CC=golang-dev https://golang.org/cl/10741043
1 parent a3f842a commit 7a0dc1c

File tree

5 files changed

+44
-44
lines changed

5 files changed

+44
-44
lines changed

test/fixedbugs/issue4232.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ package p
88

99
func f() {
1010
var a [10]int
11-
_ = a[-1] // ERROR "invalid array index -1"
12-
_ = a[-1:] // ERROR "invalid slice index -1"
13-
_ = a[:-1] // ERROR "invalid slice index -1"
14-
_ = a[10] // ERROR "invalid array index 10"
11+
_ = a[-1] // ERROR "invalid array index -1|index out of bounds"
12+
_ = a[-1:] // ERROR "invalid slice index -1|index out of bounds"
13+
_ = a[:-1] // ERROR "invalid slice index -1|index out of bounds"
14+
_ = a[10] // ERROR "invalid array index 10|index out of bounds"
1515

1616
var s []int
17-
_ = s[-1] // ERROR "invalid slice index -1"
18-
_ = s[-1:] // ERROR "invalid slice index -1"
19-
_ = s[:-1] // ERROR "invalid slice index -1"
17+
_ = s[-1] // ERROR "invalid slice index -1|index out of bounds"
18+
_ = s[-1:] // ERROR "invalid slice index -1|index out of bounds"
19+
_ = s[:-1] // ERROR "invalid slice index -1|index out of bounds"
2020
_ = s[10]
2121

2222
const c = "foo"
23-
_ = c[-1] // ERROR "invalid string index -1"
24-
_ = c[-1:] // ERROR "invalid slice index -1"
25-
_ = c[:-1] // ERROR "invalid slice index -1"
26-
_ = c[3] // ERROR "invalid string index 3"
23+
_ = c[-1] // ERROR "invalid string index -1|index out of bounds"
24+
_ = c[-1:] // ERROR "invalid slice index -1|index out of bounds"
25+
_ = c[:-1] // ERROR "invalid slice index -1|index out of bounds"
26+
_ = c[3] // ERROR "invalid string index 3|index out of bounds"
2727

2828
var t string
29-
_ = t[-1] // ERROR "invalid string index -1"
30-
_ = t[-1:] // ERROR "invalid slice index -1"
31-
_ = t[:-1] // ERROR "invalid slice index -1"
29+
_ = t[-1] // ERROR "invalid string index -1|index out of bounds"
30+
_ = t[-1:] // ERROR "invalid slice index -1|index out of bounds"
31+
_ = t[:-1] // ERROR "invalid slice index -1|index out of bounds"
3232
_ = t[3]
3333
}

test/fixedbugs/issue4452.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
package main
1010

1111
func main() {
12-
_ = [...]int(4) // ERROR "use of \[\.\.\.\] array outside of array literal"
12+
_ = [...]int(4) // ERROR "\[\.\.\.\].*outside of array literal"
1313
}

test/fixedbugs/issue4463.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ func F() {
4545
(println("bar"))
4646
(recover())
4747

48-
go append(a, 0) // ERROR "discards result"
49-
go cap(a) // ERROR "discards result"
50-
go complex(1, 2) // ERROR "discards result"
51-
go imag(1i) // ERROR "discards result"
52-
go len(a) // ERROR "discards result"
53-
go make([]int, 10) // ERROR "discards result"
54-
go new(int) // ERROR "discards result"
55-
go real(1i) // ERROR "discards result"
56-
go unsafe.Alignof(a) // ERROR "discards result"
57-
go unsafe.Offsetof(s.f) // ERROR "discards result"
58-
go unsafe.Sizeof(a) // ERROR "discards result"
48+
go append(a, 0) // ERROR "not used|discards result"
49+
go cap(a) // ERROR "not used|discards result"
50+
go complex(1, 2) // ERROR "not used|discards result"
51+
go imag(1i) // ERROR "not used|discards result"
52+
go len(a) // ERROR "not used|discards result"
53+
go make([]int, 10) // ERROR "not used|discards result"
54+
go new(int) // ERROR "not used|discards result"
55+
go real(1i) // ERROR "not used|discards result"
56+
go unsafe.Alignof(a) // ERROR "not used|discards result"
57+
go unsafe.Offsetof(s.f) // ERROR "not used|discards result"
58+
go unsafe.Sizeof(a) // ERROR "not used|discards result"
5959

6060
go close(c)
6161
go copy(a, a)
@@ -65,17 +65,17 @@ func F() {
6565
go println("bar")
6666
go recover()
6767

68-
defer append(a, 0) // ERROR "discards result"
69-
defer cap(a) // ERROR "discards result"
70-
defer complex(1, 2) // ERROR "discards result"
71-
defer imag(1i) // ERROR "discards result"
72-
defer len(a) // ERROR "discards result"
73-
defer make([]int, 10) // ERROR "discards result"
74-
defer new(int) // ERROR "discards result"
75-
defer real(1i) // ERROR "discards result"
76-
defer unsafe.Alignof(a) // ERROR "discards result"
77-
defer unsafe.Offsetof(s.f) // ERROR "discards result"
78-
defer unsafe.Sizeof(a) // ERROR "discards result"
68+
defer append(a, 0) // ERROR "not used|discards result"
69+
defer cap(a) // ERROR "not used|discards result"
70+
defer complex(1, 2) // ERROR "not used|discards result"
71+
defer imag(1i) // ERROR "not used|discards result"
72+
defer len(a) // ERROR "not used|discards result"
73+
defer make([]int, 10) // ERROR "not used|discards result"
74+
defer new(int) // ERROR "not used|discards result"
75+
defer real(1i) // ERROR "not used|discards result"
76+
defer unsafe.Alignof(a) // ERROR "not used|discards result"
77+
defer unsafe.Offsetof(s.f) // ERROR "not used|discards result"
78+
defer unsafe.Sizeof(a) // ERROR "not used|discards result"
7979

8080
defer close(c)
8181
defer copy(a, a)

test/fixedbugs/issue4813.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ var (
3131
a3 = A[f2] // ERROR "truncated"
3232
a4 = A[c]
3333
a5 = A[c2] // ERROR "truncated"
34-
a6 = A[vf] // ERROR "non-integer"
35-
a7 = A[vc] // ERROR "non-integer"
34+
a6 = A[vf] // ERROR "non-integer|must be integer"
35+
a7 = A[vc] // ERROR "non-integer|must be integer"
3636

3737
s1 = S[i]
3838
s2 = S[f]
3939
s3 = S[f2] // ERROR "truncated"
4040
s4 = S[c]
4141
s5 = S[c2] // ERROR "truncated"
42-
s6 = S[vf] // ERROR "non-integer"
43-
s7 = S[vc] // ERROR "non-integer"
42+
s6 = S[vf] // ERROR "non-integer|must be integer"
43+
s7 = S[vc] // ERROR "non-integer|must be integer"
4444

4545
t1 = T[i]
4646
t2 = T[f]
4747
t3 = T[f2] // ERROR "truncated"
4848
t4 = T[c]
4949
t5 = T[c2] // ERROR "truncated"
50-
t6 = T[vf] // ERROR "non-integer"
51-
t7 = T[vc] // ERROR "non-integer"
50+
t6 = T[vf] // ERROR "non-integer|must be integer"
51+
t7 = T[vc] // ERROR "non-integer|must be integer"
5252
)

test/fixedbugs/issue5609.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ package pkg
1010

1111
const Large uint64 = 18446744073709551615
1212

13-
var foo [Large]uint64 // ERROR "array bound is too large"
13+
var foo [Large]uint64 // ERROR "array bound is too large|array bound overflows"

0 commit comments

Comments
 (0)