From: Bjørn Erik Pedersen Date: Sun, 14 Apr 2024 13:54:49 +0000 (+0200) Subject: helpers: Add BenchmarkTrimShortHTML X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bfc3122f8eac0f8c7a96d057ed39a48265506be9;p=brevno-suite%2Fhugo helpers: Add BenchmarkTrimShortHTML --- diff --git a/helpers/content_test.go b/helpers/content_test.go index e2bf501d2..53e18e727 100644 --- a/helpers/content_test.go +++ b/helpers/content_test.go @@ -50,6 +50,14 @@ func TestTrimShortHTML(t *testing.T) { } } +func BenchmarkTrimShortHTML(b *testing.B) { + c := newTestContentSpec(nil) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.TrimShortHTML([]byte("

Simple paragraph

")) + } +} + func TestBytesToHTML(t *testing.T) { c := qt.New(t) c.Assert(helpers.BytesToHTML([]byte("dobedobedo")), qt.Equals, template.HTML("dobedobedo"))