Use t.Helper to make the reported failure lines more helpful.
Change-Id: I6593924b3892b2441a197aee4e05f71ea236d426
GitHub-Last-Rev:
2e020ea85cf44c6cc0e90cb919eb0d7bb5a1c315
GitHub-Pull-Request: golang/go#68843
Reviewed-on: https://go-review.googlesource.com/c/go/+/604755
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
}
func testParameterGeneration(t *testing.T, sizes ParameterSizes, L, N int) {
+ t.Helper()
var priv PrivateKey
params := &priv.Parameters
)
func mustDecodeHex(t *testing.T, in string) []byte {
+ t.Helper()
b, err := hex.DecodeString(in)
if err != nil {
t.Fatal(err)
}
func newLocalListener(t testing.TB) net.Listener {
+ t.Helper()
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
ln, err = net.Listen("tcp6", "[::1]:0")
)
func boringRSAKey(t *testing.T, size int) *rsa.PrivateKey {
+ t.Helper()
k, err := rsa.GenerateKey(rand.Reader, size)
if err != nil {
t.Fatal(err)
}
func boringECDSAKey(t *testing.T, curve elliptic.Curve) *ecdsa.PrivateKey {
+ t.Helper()
k, err := ecdsa.GenerateKey(curve, rand.Reader)
if err != nil {
t.Fatal(err)
}
func mustNewOIDFromInts(t testing.TB, ints []uint64) OID {
+ t.Helper()
oid, err := OIDFromInts(ints)
if err != nil {
t.Fatalf("OIDFromInts(%v) unexpected error: %v", ints, err)
}
func marshalAndParseCSR(t *testing.T, template *CertificateRequest) *CertificateRequest {
+ t.Helper()
derBytes, err := CreateCertificateRequest(rand.Reader, template, testPrivateKey)
if err != nil {
t.Fatal(err)
// serialiseAndParse generates a self-signed certificate from template and
// returns a parsed version of it.
func serialiseAndParse(t *testing.T, template *Certificate) *Certificate {
+ t.Helper()
derBytes, err := CreateCertificate(rand.Reader, template, template, &testPrivateKey.PublicKey, testPrivateKey)
if err != nil {
t.Fatalf("failed to create certificate: %s", err)
s.add(h.Sum64())
}
func (s *hashSet) check(t *testing.T) {
+ t.Helper()
list := s.list
slices.Sort(list)
sparse(t, h, 2048, 2)
}
func sparse(t *testing.T, h *hashSet, n int, k int) {
+ t.Helper()
b := make([]byte, n/8)
setbits(h, b, 0, k)
h.check(t)
permutation(t, h, []uint32{0, 1, 2, 3, 4, 5, 6, 7, 1 << 29, 2 << 29, 3 << 29, 4 << 29, 5 << 29, 6 << 29, 7 << 29}, 6)
}
func permutation(t *testing.T, h *hashSet, s []uint32, n int) {
+ t.Helper()
b := make([]byte, n*4)
genPerm(h, b, s, 0)
h.check(t)
avalancheTest1(t, &bytesKey{make([]byte, 200)})
}
func avalancheTest1(t *testing.T, k key) {
+ t.Helper()
const REP = 100000
r := rand.New(rand.NewSource(1234))
n := k.bits()
text(t, h, "", "FooBar")
}
func text(t *testing.T, h *hashSet, prefix, suffix string) {
+ t.Helper()
const N = 4
const S = "ABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrst0123456789"
const L = len(S)