Skip to content

Commit 0f9552b

Browse files
committed
no warning when a top level test has no subtests
1 parent a9ada19 commit 0f9552b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

testdata/src/test/without_sub_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package test
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestWithoutSub(t *testing.T) { // OK
8+
t.Parallel()
9+
call("TestWithoutSub")
10+
}

tparallel.go

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ func run(pass *analysis.Pass) (interface{}, error) {
4040

4141
testMap := getTestMap(ssaanalyzer, testTyp) // ex. {Test1: [TestSub1, TestSub2], Test2: [TestSub1, TestSub2, TestSub3], ...}
4242
for top, subs := range testMap {
43+
if len(subs) == 0 {
44+
continue
45+
}
4346
isParallelTop := ssafunc.IsCalled(top, parallel)
4447
isPararellSub := false
4548
for _, sub := range subs {

0 commit comments

Comments
 (0)