-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
The go test -run flag can be used to select multiple root test cases. This example will run the 3 tests which match the regex exactly:
go test -run '^(TestOne|TestTwo|TestThree)$'As far as I can tell, the logic for handling subtests makes it impossible to do the same with subtest cases. It seems to be possible to run multiple root test cases, with a single subtest case:
go test -run '^TestOne$|^TestTwo$|^TestThree$/^SubTestA$'But adding anything after the / is assumed to be a sub-sub test, and does not match the same way.
Some other things that I tried, which do not work:
Matches any SubTestA, not just the one from TestThree
^(TestOne|TestTwo|TestThree)$/^SubTestA$
Does not match any subtests
Because of how parenthesis are handled in splitRegex
(^TestOne$|^TestTwo$|^TestThree$/^SubTestA$)
Would it be reasonable to support this with the -run flag? Looking over the matching logic in src/testing it seems like this may not be a small change.