diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-06-12 14:43:35 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-06-12 14:44:07 +0200 |
commit | 5db215d4d6e4a0e353ea9aa21441d9ca4d7caf12 (patch) | |
tree | 69fc01399dba8429a938d7249a7f628ba100c88c /helpers/url_test.go | |
parent | b7dc93ca11b3aa7fb20e302c29c65af17067526d (diff) | |
download | hugo-5db215d4d6e4a0e353ea9aa21441d9ca4d7caf12.tar.gz hugo-5db215d4d6e4a0e353ea9aa21441d9ca4d7caf12.zip |
helpers: Add a basic benchmark for RelURL
Diffstat (limited to 'helpers/url_test.go')
-rw-r--r-- | helpers/url_test.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/helpers/url_test.go b/helpers/url_test.go index 787cdd6e8..bb7f6eed7 100644 --- a/helpers/url_test.go +++ b/helpers/url_test.go @@ -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() @@ -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) + } +} |