Skip to content

Commit f4ce11e

Browse files
aykevldeadprogram
authored andcommitted
main: add error tests for the compiler
The compiler can in fact return errors, but these weren't tested yet.
1 parent a5f78a3 commit f4ce11e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

errors_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
func TestErrors(t *testing.T) {
1818
for _, name := range []string{
1919
"cgo",
20+
"compiler",
2021
"interp",
2122
"loader-importcycle",
2223
"loader-invaliddep",

testdata/errors/compiler.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
//go:wasmimport foo bar
4+
func foo() {
5+
}
6+
7+
//go:align 7
8+
var global int
9+
10+
// TODO: include package name in the error message
11+
12+
// ERROR: compiler.go:4:6: can only use //go:wasmimport on declarations
13+
// ERROR: compiler.go:8:5: global variable alignment must be a positive power of two

0 commit comments

Comments
 (0)