Skip to content

Commit e78eb5a

Browse files
committed
refactor(routes): use b.Loop()
1 parent aa3a0b5 commit e78eb5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

routes_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func BenchmarkRouteTrailingSlashInsensitivity(b *testing.B) {
307307
b.ResetTimer()
308308
b.ReportAllocs()
309309

310-
for i := 0; i < b.N; i++ {
310+
for b.Loop() {
311311
// Cause an insensitive match. Test if the retry logic is causing
312312
// slowdowns.
313313
w := PerformRequest(router, http.MethodGet, "/path/")
@@ -326,7 +326,7 @@ func BenchmarkRouteTrailingSlashInsensitivity(b *testing.B) {
326326
b.ResetTimer()
327327
b.ReportAllocs()
328328

329-
for i := 0; i < b.N; i++ {
329+
for b.Loop() {
330330
w := PerformRequest(router, http.MethodGet, "/path") // Exact match.
331331
if w.Code != http.StatusOK || w.Body.String() != "path" {
332332
b.Fatalf("Expected status %d, got %d", http.StatusOK, w.Code)
@@ -343,7 +343,7 @@ func BenchmarkRouteTrailingSlashInsensitivity(b *testing.B) {
343343
b.ResetTimer()
344344
b.ReportAllocs()
345345

346-
for i := 0; i < b.N; i++ {
346+
for b.Loop() {
347347
w := PerformRequest(router, http.MethodGet, "/path/") // Redirect.
348348
if w.Code != http.StatusMovedPermanently {
349349
b.Fatalf("Expected status %d, got %d", http.StatusMovedPermanently, w.Code)

0 commit comments

Comments
 (0)