Skip to content

Commit c5879c6

Browse files
leongrossdeadprogram
authored andcommitted
fix: implement testing {Skip,Fail}Now
PR #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 <[email protected]>
1 parent 190c208 commit c5879c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/testing/testing.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"io/fs"
1818
"math/rand"
1919
"os"
20+
"runtime"
2021
"strconv"
2122
"strings"
2223
"time"
@@ -207,9 +208,8 @@ func (c *common) Failed() bool {
207208
// current goroutine).
208209
func (c *common) FailNow() {
209210
c.Fail()
210-
211211
c.finished = true
212-
c.Error("FailNow is incomplete, requires runtime.Goexit()")
212+
runtime.Goexit()
213213
}
214214

215215
// log generates the output.
@@ -281,7 +281,7 @@ func (c *common) Skipf(format string, args ...interface{}) {
281281
func (c *common) SkipNow() {
282282
c.skip()
283283
c.finished = true
284-
c.Error("SkipNow is incomplete, requires runtime.Goexit()")
284+
runtime.Goexit()
285285
}
286286

287287
func (c *common) skip() {

0 commit comments

Comments
 (0)