mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
tpl/strings: Adjust benchmark
This commit is contained in:
parent
079d1b6540
commit
2a61910e82
1 changed files with 12 additions and 3 deletions
|
@ -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")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue