mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 02:57:46 +00:00
runtime, testing: support Goexit, SkipNow, FailNow
Keep a pending Goexit separate from the active panic state so recovered deferred panics do not cancel the original Goexit unwind. Goexit should also ignore -panic=trap, since it is not a panic. Wire testing.FailNow and SkipNow through runtime.Goexit, and run tests and benchmarks in goroutines. This lets Goexit terminate the user function without skipping test bookkeeping. Add Goexit/recover coverage and enable crypto/ecdh in the Linux stdlib test list.
This commit is contained in:
Vendored
+12
-1
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"io"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -25,11 +26,21 @@ func TestBar(t *testing.T) {
|
||||
t.Log("after failed")
|
||||
})
|
||||
t.Run("Bar3", func(t *testing.T) {})
|
||||
if runtime.GOARCH != "wasm" {
|
||||
t.Run("Bar4", func(t *testing.T) {
|
||||
t.Fatal("fatal")
|
||||
t.Log("after fatal")
|
||||
})
|
||||
t.Run("Bar5", func(t *testing.T) {
|
||||
t.SkipNow()
|
||||
t.Error("after skip")
|
||||
})
|
||||
}
|
||||
t.Log("log Bar end")
|
||||
}
|
||||
|
||||
func TestAllLowercase(t *testing.T) {
|
||||
names := []string {
|
||||
names := []string{
|
||||
"alpha",
|
||||
"BETA",
|
||||
"gamma",
|
||||
|
||||
Reference in New Issue
Block a user