Skip to content

Commit 3788b31

Browse files
aykevldeadprogram
authored andcommitted
main: add test for error coming from the optimizer
This is just one optimizer pass that's easy to test for. There are others, but I'm ignoring them for now. The one other that would be reasonable to test is when starting a goroutine with -gc=none, but I'm leaving that one for another time.
1 parent f4ce11e commit 3788b31

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

errors_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func TestErrors(t *testing.T) {
2323
"loader-invaliddep",
2424
"loader-invalidpackage",
2525
"loader-nopackage",
26+
"optimizer",
2627
"syntax",
2728
"types",
2829
} {

testdata/errors/optimizer.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import "runtime/interrupt"
4+
5+
var num = 5
6+
7+
func main() {
8+
// Error coming from LowerInterrupts.
9+
interrupt.New(num, func(interrupt.Interrupt) {
10+
})
11+
12+
// 2nd error
13+
interrupt.New(num, func(interrupt.Interrupt) {
14+
})
15+
}
16+
17+
// ERROR: optimizer.go:9:15: interrupt ID is not a constant
18+
// ERROR: optimizer.go:13:15: interrupt ID is not a constant

0 commit comments

Comments
 (0)