@@ -7,24 +7,19 @@ import (
77 "github.com/stretchr/testify/assert"
88)
99
10- func runTestCases (t * testing.T , testCases [] testCase ) {
10+ func runTestCases (t * testing.T , testCases ... testCase ) {
1111 t .Helper ()
1212
1313 for _ , tc := range testCases {
14- t .Run (tc .name , func (tt * testing.T ) {
15- runTestCase (tt , tc )
14+ t .Run (tc .name , func (t * testing.T ) {
15+ t .Parallel ()
16+ result , err := textplain .Convert (tc .body , textplain .DefaultLineLength )
17+ assert .NoError (t , err )
18+ assert .Equal (t , tc .expect , result )
1619 })
1720 }
1821}
1922
20- func runTestCase (t * testing.T , tc testCase ) {
21- t .Helper ()
22-
23- result , err := textplain .Convert (tc .body , textplain .DefaultLineLength )
24- assert .Nil (t , err )
25- assert .Equal (t , tc .expect , result )
26- }
27-
2823const html = `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head>
2924<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
3025 <style type="text/css">
@@ -53,7 +48,7 @@ const html = `<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "htt
5348
5449func BenchmarkTree (b * testing.B ) {
5550 converter := textplain .NewTreeConverter ()
56- for i := 0 ; i < b .N ; i ++ {
51+ for range b .N {
5752 _ , _ = converter .Convert (html , textplain .DefaultLineLength )
5853 }
5954}
0 commit comments