testing: add Testing function

This is new in Go 1.21.
This commit is contained in:
Ayke van Laethem
2023-07-26 13:23:44 +02:00
committed by Ron Evans
parent 215dd3f0be
commit c25dd0a972
4 changed files with 29 additions and 3 deletions
+3
View File
@@ -73,6 +73,9 @@ func fakeMatchString(pat, str string) (bool, error) {
}
func main() {
if testing.Testing() {
println("not running a test at the moment, testing.Testing() should return false")
}
testing.Init()
flag.Set("test.run", ".*/B")
m := testing.MainStart(matchStringOnly(fakeMatchString /*regexp.MatchString*/), tests, benchmarks, fuzzes, examples)