From c5879c682c834e242aa86f86df2ba4984dfd9ba9 Mon Sep 17 00:00:00 2001 From: leongross Date: Fri, 14 Feb 2025 16:53:34 +0100 Subject: [PATCH] fix: implement testing {Skip,Fail}Now PR https://github.com/tinygo-org/tinygo/pull/4623 implements runtime.GoExit() with which we can improve the testing package and align it more to upstream testing behavour https://cs.opensource.google/go/go/+/refs/tags/go1.24.0:src/testing/testing.go;l=1150 Signed-off-by: leongross --- src/testing/testing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index 9058892d2..cd19ada71 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -17,6 +17,7 @@ import ( "io/fs" "math/rand" "os" + "runtime" "strconv" "strings" "time" @@ -207,9 +208,8 @@ func (c *common) Failed() bool { // current goroutine). func (c *common) FailNow() { c.Fail() - c.finished = true - c.Error("FailNow is incomplete, requires runtime.Goexit()") + runtime.Goexit() } // log generates the output. @@ -281,7 +281,7 @@ func (c *common) Skipf(format string, args ...interface{}) { func (c *common) SkipNow() { c.skip() c.finished = true - c.Error("SkipNow is incomplete, requires runtime.Goexit()") + runtime.Goexit() } func (c *common) skip() {