Addtional test for benchmarking the wrapLines() function

This commit is contained in:
asdf 2019-09-05 10:48:47 +10:00
parent fb2130518c
commit 319138b189
1 changed files with 13 additions and 0 deletions

View File

@ -34,3 +34,16 @@ func Test_wrapLines_doesnt_break_indents(t *testing.T) {
}
}
}
func Benchmark_wrapLines(b *testing.B) {
indent := " "
teststring := []string{
indent + "0123456789\n",
indent + "a really long line that will prolly be wrapped\n",
indent + "a l i n e w i t h a l o t o f w o r d s\n",
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
wrapLines(teststring, 20)
}
}