aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2024-07-12 14:32:50 +0200
committerRon Evans <[email protected]>2024-07-20 14:30:34 +0200
commita5f78a390065204d161fa80d0cfa83f9d0268d85 (patch)
treecefe0c5ee753c46f88d0df7368fde2dce5d95e80 /testdata
parente409950492340d0e74db681de25f4a2a0dc84b37 (diff)
downloadtinygo-a5f78a390065204d161fa80d0cfa83f9d0268d85.tar.gz
tinygo-a5f78a390065204d161fa80d0cfa83f9d0268d85.zip
main: add interp tests
This one needed more advanced checking of the error messages, because we don't want to hardcode things like `!dbg !10` in the output.
Diffstat (limited to 'testdata')
-rw-r--r--testdata/errors/interp.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/testdata/errors/interp.go b/testdata/errors/interp.go
new file mode 100644
index 000000000..a3f5cee78
--- /dev/null
+++ b/testdata/errors/interp.go
@@ -0,0 +1,31 @@
+package main
+
+import _ "unsafe"
+
+func init() {
+ foo()
+}
+
+func foo() {
+ interp_test_error()
+}
+
+// This is a function that always causes an error in interp, for testing.
+//
+//go:linkname interp_test_error __tinygo_interp_raise_test_error
+func interp_test_error()
+
+func main() {
+}
+
+// ERROR: # main
+// ERROR: {{.*testdata[\\/]errors[\\/]interp\.go}}:10:19: test error
+// ERROR: call void @__tinygo_interp_raise_test_error{{.*}}
+// ERROR: {{}}
+// ERROR: traceback:
+// ERROR: {{.*testdata[\\/]errors[\\/]interp\.go}}:10:19:
+// ERROR: call void @__tinygo_interp_raise_test_error{{.*}}
+// ERROR: {{.*testdata[\\/]errors[\\/]interp\.go}}:6:5:
+// ERROR: call void @main.foo{{.*}}
+// ERROR: {{.*testdata[\\/]errors}}:
+// ERROR: call void @"main.init#1"{{.*}}