aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorNia Waldvogel <[email protected]>2022-01-02 12:13:32 -0500
committerNia <[email protected]>2022-01-03 18:59:19 -0500
commitd86dd642b30a42becc99dc050070d1c96f69678e (patch)
treec9d530b468773573536fba78d7e7b8c4917c9305 /tests
parent21b89ef327b549dbe133424a571966b77e7ef5be (diff)
downloadtinygo-d86dd642b30a42becc99dc050070d1c96f69678e.tar.gz
tinygo-d86dd642b30a42becc99dc050070d1c96f69678e.zip
main (test): add tests to `tinygo test`
Diffstat (limited to 'tests')
-rw-r--r--tests/testing/builderr/builderr.go10
-rw-r--r--tests/testing/builderr/builderr_test.go11
-rw-r--r--tests/testing/fail/fail_test.go7
-rw-r--r--tests/testing/nothing/nothing.go3
-rw-r--r--tests/testing/pass/pass_test.go7
5 files changed, 38 insertions, 0 deletions
diff --git a/tests/testing/builderr/builderr.go b/tests/testing/builderr/builderr.go
new file mode 100644
index 000000000..71a38b2e8
--- /dev/null
+++ b/tests/testing/builderr/builderr.go
@@ -0,0 +1,10 @@
+package builderr
+
+import _ "unsafe"
+
+//go:linkname x notARealFunction
+func x()
+
+func Thing() {
+ x()
+}
diff --git a/tests/testing/builderr/builderr_test.go b/tests/testing/builderr/builderr_test.go
new file mode 100644
index 000000000..1ac8a7e00
--- /dev/null
+++ b/tests/testing/builderr/builderr_test.go
@@ -0,0 +1,11 @@
+package builderr_test
+
+import (
+ "testing"
+
+ "github.com/tinygo-org/tinygo/tests/testing/builderr"
+)
+
+func TestThing(t *testing.T) {
+ builderr.Thing()
+}
diff --git a/tests/testing/fail/fail_test.go b/tests/testing/fail/fail_test.go
new file mode 100644
index 000000000..156ca4235
--- /dev/null
+++ b/tests/testing/fail/fail_test.go
@@ -0,0 +1,7 @@
+package fail_test
+
+import "testing"
+
+func TestFail(t *testing.T) {
+ t.Error("fail")
+}
diff --git a/tests/testing/nothing/nothing.go b/tests/testing/nothing/nothing.go
new file mode 100644
index 000000000..209106028
--- /dev/null
+++ b/tests/testing/nothing/nothing.go
@@ -0,0 +1,3 @@
+package nothing
+
+// This package has no tests.
diff --git a/tests/testing/pass/pass_test.go b/tests/testing/pass/pass_test.go
new file mode 100644
index 000000000..3dd229385
--- /dev/null
+++ b/tests/testing/pass/pass_test.go
@@ -0,0 +1,7 @@
+package pass_test
+
+import "testing"
+
+func TestPass(t *testing.T) {
+ // This test passes.
+}