mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
tpl/strings: Adjust benchmark
This commit is contained in:
@ -83,7 +83,16 @@ func TestTruncate(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkTruncate(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
ns.Truncate(10, "<p>test <b>hello</b> test something</p>")
|
||||
}
|
||||
b.Run("Plain text", func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
ns.Truncate(10, "I am a test sentence")
|
||||
}
|
||||
})
|
||||
|
||||
b.Run("With link", func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
ns.Truncate(10, "I have a <a href='/markdown'>Markdown link</a> inside")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user