mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
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 <leon.gross@9elements.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -207,9 +208,8 @@ func (c *common) Failed() bool {
|
|||||||
// current goroutine).
|
// current goroutine).
|
||||||
func (c *common) FailNow() {
|
func (c *common) FailNow() {
|
||||||
c.Fail()
|
c.Fail()
|
||||||
|
|
||||||
c.finished = true
|
c.finished = true
|
||||||
c.Error("FailNow is incomplete, requires runtime.Goexit()")
|
runtime.Goexit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// log generates the output.
|
// log generates the output.
|
||||||
@@ -281,7 +281,7 @@ func (c *common) Skipf(format string, args ...interface{}) {
|
|||||||
func (c *common) SkipNow() {
|
func (c *common) SkipNow() {
|
||||||
c.skip()
|
c.skip()
|
||||||
c.finished = true
|
c.finished = true
|
||||||
c.Error("SkipNow is incomplete, requires runtime.Goexit()")
|
runtime.Goexit()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *common) skip() {
|
func (c *common) skip() {
|
||||||
|
|||||||
Reference in New Issue
Block a user