From 319138b189c084f226b5ce3b6359392fe44031c5 Mon Sep 17 00:00:00 2001 From: asdf Date: Thu, 5 Sep 2019 10:48:47 +1000 Subject: [PATCH] Addtional test for benchmarking the wrapLines() function --- cui/cui_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cui/cui_test.go b/cui/cui_test.go index 755fa02..0c3f198 100644 --- a/cui/cui_test.go +++ b/cui/cui_test.go @@ -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) + } +}