-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot filter test names with commas using swift test --filter
#458
Comments
younata
changed the title
Cannot filter test names with commas.
Cannot filter test names with commas using Jun 30, 2023
swift test --filter
Duplicate of #417 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
I maintain the Quick testing framework. This issue comes as a result of a bug reported to Quick. Quick provides a DSL for organizing tests that, amongst other things, allows you to use any arbitrary string as the name of a test. For example, the following bit from Quick's DSL:
This code sample will generate a test, using xcodebuild's test filtering syntax, named
"SomeSpec"/"can include any character you want, including commas"
(double quotes added to make it easier to differentiate).On Darwin platforms, this takes advantage of the fact that objc selectors can be any UTF-8 string. On non-Darwin platforms, this uses the
allTests
infrastructure to name tests. That is to say, this is not a bug in Quick's XCTest integration, you can easily reproduce this in pure XCTest (in SPM) with the following code:The bug is that, using
swift test --filter
, you can not select tests with commas in their names. That is, in the first example,swift test --filter "SomeSpec"/"can include any character you want, including commas or /s"
will not find any tests to run. Similarly, with the second example, `swift test --filter "SomeTest/"XCTest totally can use /s or commas, right?" will not run any tests.As @natinusala reported to us, this looks to be caused by XCTest's argument parser not considering that test names might contain commas. This causes XCTest to behave as if you wanted to filter tests named
"SomeTest"/"XCTest totally works with commas"
and" right?"
, which will almost always result in no tests found that match those filters (unless you have an XCTestCase subclass that shares the same name as the characters after the comma).FWIW, this issue also exists when you use xcodebuild on Darwin, only the character that xcodebuild doesn't like filtering on is a slash.
The text was updated successfully, but these errors were encountered: