How do you filter for a test that includes parameters?
Closed this issue · 2 comments
adam-fowler commented
Description
If I have two tests with the same function name but one of which takes a list of parameters, there doesn't appear to be a way to filter the tests to only run one of the tests eg If I have the following two tests
@Test(arguments: [1,2])
func testThis(value: Int) {
#expect(value < 2)
}
@Test
func testThis() {
#expect(1 < 2)
}
There doesn't appear to be a way to differentiate between the two tests
Expected behavior
swift test --filter testThis(value:)
runs the first testswift test --filter testThis()
runs the second test
Actual behavior
swift test --filter testThis(value:)
doesn't run either of the testsswift test --filter testThis()
runs both tests
Steps to reproduce
No response
swift-testing version/commit hash
Swift & OS version (output of swift --version ; uname -a
)
No response
grynspan commented
The --filter
argument is a regular expression. You will need to escape the string you pass to it. In the example cases, I think you just want testThis\(value\:\)
and testThis\(\)
.
adam-fowler commented
Verified as working, interestingly I found you should really escape the "." and "/" when you have the full test name