Skip to content

Commit

Permalink
Merge pull request #9 from moricho/fix/without-subtests
Browse files Browse the repository at this point in the history
No warning when a top level test has no subtests
  • Loading branch information
moricho authored Sep 21, 2020
2 parents a9ada19 + 0f9552b commit 88fabab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions testdata/src/test/without_sub_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package test

import (
"testing"
)

func TestWithoutSub(t *testing.T) { // OK
t.Parallel()
call("TestWithoutSub")
}
3 changes: 3 additions & 0 deletions tparallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func run(pass *analysis.Pass) (interface{}, error) {

testMap := getTestMap(ssaanalyzer, testTyp) // ex. {Test1: [TestSub1, TestSub2], Test2: [TestSub1, TestSub2, TestSub3], ...}
for top, subs := range testMap {
if len(subs) == 0 {
continue
}
isParallelTop := ssafunc.IsCalled(top, parallel)
isPararellSub := false
for _, sub := range subs {
Expand Down

0 comments on commit 88fabab

Please sign in to comment.