tpl/strings: Add BenchmarkTruncate - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 079d1b65406a3ad6d6006f7f2be253e1d675e2e0
DIR parent a56b9071db2991a4f4e882ecb57e3fc068b02be1
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Wed, 1 Mar 2023 17:51:09 +0100
tpl/strings: Add BenchmarkTruncate
Diffstat:
M tpl/strings/truncate_test.go | 6 ++++++
1 file changed, 6 insertions(+), 0 deletions(-)
---
DIR diff --git a/tpl/strings/truncate_test.go b/tpl/strings/truncate_test.go
@@ -81,3 +81,9 @@ func TestTruncate(t *testing.T) {
t.Errorf("Should have errored")
}
}
+
+func BenchmarkTruncate(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ ns.Truncate(10, "<p>test <b>hello</b> test something</p>")
+ }
+}