From f4ce11ef37ea155ccf04e43590739a893b98a865 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 12 Jul 2024 17:05:04 +0200 Subject: main: add error tests for the compiler The compiler can in fact return errors, but these weren't tested yet. --- errors_test.go | 1 + testdata/errors/compiler.go | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 testdata/errors/compiler.go diff --git a/errors_test.go b/errors_test.go index d671e7335..1d29236ca 100644 --- a/errors_test.go +++ b/errors_test.go @@ -17,6 +17,7 @@ import ( func TestErrors(t *testing.T) { for _, name := range []string{ "cgo", + "compiler", "interp", "loader-importcycle", "loader-invaliddep", diff --git a/testdata/errors/compiler.go b/testdata/errors/compiler.go new file mode 100644 index 000000000..fb0057c93 --- /dev/null +++ b/testdata/errors/compiler.go @@ -0,0 +1,13 @@ +package main + +//go:wasmimport foo bar +func foo() { +} + +//go:align 7 +var global int + +// TODO: include package name in the error message + +// ERROR: compiler.go:4:6: can only use //go:wasmimport on declarations +// ERROR: compiler.go:8:5: global variable alignment must be a positive power of two -- cgit v1.2.3