/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
go1.25.7
test/inline_testingbloop.go
37 строк
1 KB
Austin Clements
testing: detect a stopped timer in B.Loop
24 мар 2025, 21:41
24 мар 2025, 21:41
5918101
Код
Авторство
О чём код?
// errorcheck -0 -m // Copyright 2024 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test no inlining of function calls in testing.B.Loop. // See issue #61515. package foo import "testing" func caninline(x int) int { // ERROR "can inline caninline" return x } func test(b *testing.B) { // ERROR "leaking param: b" for i := 0; i < b.N; i++ { caninline(1) // ERROR "inlining call to caninline" } for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" caninline(1) } for i := 0; i < b.N; i++ { caninline(1) // ERROR "inlining call to caninline" } for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" caninline(1) } for i := 0; i < b.N; i++ { caninline(1) // ERROR "inlining call to caninline" } for b.Loop() { // ERROR "skip inlining within testing.B.loop" "inlining call to testing\.\(\*B\)\.Loop" caninline(1) } }