mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
helpers: Add a basic benchmark for RelURL
This commit is contained in:
parent
b7dc93ca11
commit
5db215d4d6
1 changed files with 11 additions and 1 deletions
|
@ -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()
|
t.Helper()
|
||||||
c := qt.New(t)
|
c := qt.New(t)
|
||||||
v := config.New()
|
v := config.New()
|
||||||
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue