From bfc3122f8eac0f8c7a96d057ed39a48265506be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 14 Apr 2024 15:54:49 +0200 Subject: [PATCH] helpers: Add BenchmarkTrimShortHTML --- helpers/content_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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"))