Skip to content

Commit

Permalink
helpers: Add a basic benchmark for RelURL
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jun 12, 2023
1 parent b7dc93c commit 5db215d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion helpers/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestRelURL(t *testing.T) {
}
}

func doTestRelURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool, lang string) {
func doTestRelURL(t testing.TB, defaultInSubDir, addLanguage, multilingual bool, lang string) {
t.Helper()
c := qt.New(t)
v := config.New()
Expand Down Expand Up @@ -262,3 +262,13 @@ func TestSanitizeURL(t *testing.T) {
}
}
}

func BenchmarkRelURL(b *testing.B) {
v := config.New()
v.Set("baseURL", "http://base/")
p := newTestPathSpecFromCfgAndLang(v, "")
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = p.RelURL("https://base/foo/bar", false)
}
}

0 comments on commit 5db215d

Please sign in to comment.