Skip to content

Commit 54ac8b0

Browse files
committed
Use b.Loop() now that we have Go 1.24
1 parent 2271e7c commit 54ac8b0

File tree

3 files changed

+6
-27
lines changed

3 files changed

+6
-27
lines changed

internal/transport/completion_test.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@ import (
66
"github.com/alecthomas/assert/v2"
77
)
88

9-
var completions []string
10-
119
func BenchmarkNameplateCompletion(b *testing.B) {
1210
c := Client{}
13-
14-
local := []string{}
15-
16-
for range b.N {
17-
local = c.GenerateCodeCompletion("1-letterhead-be")
11+
for b.Loop() {
12+
c.GenerateCodeCompletion("1-letterhead-be")
1813
}
19-
20-
completions = local
2114
}
2215

2316
func TestCompletionGeneration_Progressive(t *testing.T) {

internal/ui/tabs_test.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,15 @@ import (
55
"testing"
66

77
"fyne.io/fyne/v2/app"
8-
"fyne.io/fyne/v2/container"
98
)
109

11-
var globalTabs *container.AppTabs
12-
1310
func BenchmarkCreate(b *testing.B) {
14-
b.StopTimer()
1511
a := app.NewWithID("io.github.jacalz.rymdport")
1612
w := a.NewWindow("Rymdport")
17-
var tabs *container.AppTabs
1813
os.Args = []string{"rymdport"} // Don't read test arguments as uri input.
19-
b.StartTimer()
2014

2115
b.ReportAllocs()
22-
for range b.N {
23-
tabs = Create(a, w)
16+
for b.Loop() {
17+
Create(a, w)
2418
}
25-
26-
// Don't allow the compiler to optimize out.
27-
globalTabs = tabs
2819
}

internal/util/util_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@ import (
99
"github.com/alecthomas/assert/v2"
1010
)
1111

12-
var globalValidationError error
13-
1412
func BenchmarkCodeValidator(b *testing.B) {
15-
local := error(nil)
16-
17-
for range b.N {
18-
local = CodeValidator("125-upset-universe-mistake")
13+
for b.Loop() {
14+
CodeValidator("125-upset-universe-mistake")
1915
}
2016

21-
globalValidationError = local
2217
}
2318

2419
var codeValidatorTestcases = []struct {

0 commit comments

Comments
 (0)