]> Cypherpunks.ru repositories - gostls13.git/commit
testing: don't allow f.Log/Logf or f.Skipped inside f.Fuzz
authorKatie Hockman <katie@golang.org>
Fri, 15 Oct 2021 15:16:54 +0000 (11:16 -0400)
committerKatie Hockman <katie@golang.org>
Tue, 19 Oct 2021 18:18:37 +0000 (18:18 +0000)
commit982060203c26b60fd74e4fa2fd967600c65ee7fc
tree9ee4a45e3d70ed5e6c4389cd4440d6ff283267ad
parent404f84d417ceed0f47e51d2c4f933a6dee96dca5
testing: don't allow f.Log/Logf or f.Skipped inside f.Fuzz

This change also does some refactors around how
we prevent many (*F) methods from being called
inside (*F).Fuzz. Previously, there was a lot of
comment/code duplication, which was going to be
difficult to maintain and brittle. The refactor
lessens this duplication.

Previously, the methods Log, Logf, Failed, Name and
Skipped were the only (*common) methods that were
allowed to be called inside (*F).Fuzz. After this
change, Failed and Name are still allowed, but
Log, Logf, and Skipped are not (t.Log, t.Logf, or
t.Skipped should be used instead).

Fixes #48988

Change-Id: I4066247d551ea1908e8a2ca2889509fc68e3bb44
Reviewed-on: https://go-review.googlesource.com/c/go/+/356151
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/testdata/script/test_fuzz.txt
src/testing/fuzz.go
src/testing/testing.go