Debian Codegraph @

src/cmd/compile/internal/test/issue71943_test.go

raw
1 // Copyright 2025 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package test
6
7 import (
8 "crypto/sha256"
9 "internal/testenv"
10 "runtime"
11 "testing"
12 )
13
14 func Verify(token, salt string) [32]byte {
15 return sha256.Sum256([]byte(token + salt))
16 }
17
18 func TestIssue71943(t *testing.T) {
19 testenv.SkipIfOptimizationOff(t)
20 if n := testing.AllocsPerRun(10, func() {
21 runtime.KeepAlive(Verify("teststring", "test"))
22 }); n > 0 {
23 t.Fatalf("unexpected allocation: %f", n)
24 }
25 }