aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-04-14 15:54:49 +0200
committerBjørn Erik Pedersen <[email protected]>2024-04-14 15:54:49 +0200
commitbfc3122f8eac0f8c7a96d057ed39a48265506be9 (patch)
tree1256bc021f75dd772e7ec7e54294ea54ccd27651
parent00ae8e8c7242cbff202258a6b78f169cf796457c (diff)
downloadhugo-bfc3122f8eac0f8c7a96d057ed39a48265506be9.tar.gz
hugo-bfc3122f8eac0f8c7a96d057ed39a48265506be9.zip
helpers: Add BenchmarkTrimShortHTML
-rw-r--r--helpers/content_test.go8
1 files changed, 8 insertions, 0 deletions
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("<p>Simple paragraph</p>"))
+ }
+}
+
func TestBytesToHTML(t *testing.T) {
c := qt.New(t)
c.Assert(helpers.BytesToHTML([]byte("dobedobedo")), qt.Equals, template.HTML("dobedobedo"))