Skip to content

Commit

Permalink
main: add test for error coming from the optimizer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aykevl authored and deadprogram committed Jul 20, 2024
1 parent f4ce11e commit 3788b31
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestErrors(t *testing.T) {
"loader-invaliddep",
"loader-invalidpackage",
"loader-nopackage",
"optimizer",
"syntax",
"types",
} {
Expand Down
18 changes: 18 additions & 0 deletions testdata/errors/optimizer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import "runtime/interrupt"

var num = 5

func main() {
// Error coming from LowerInterrupts.
interrupt.New(num, func(interrupt.Interrupt) {
})

// 2nd error
interrupt.New(num, func(interrupt.Interrupt) {
})
}

// ERROR: optimizer.go:9:15: interrupt ID is not a constant
// ERROR: optimizer.go:13:15: interrupt ID is not a constant

0 comments on commit 3788b31

Please sign in to comment.