-
Notifications
You must be signed in to change notification settings - Fork 263
Add Help Printing to XCTest executables #286
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
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this improvement! I have just a few small suggestions below. CC @briancroom
@@ -87,6 +87,33 @@ public func XCTMain(_ testCases: [XCTestCaseEntry]) -> Never { | |||
case .list(type: .json): | |||
TestListing(testSuite: rootTestSuite).printTestJSON() | |||
exit(0) | |||
case let .help(invalidOption): | |||
if let invalid = invalidOption { | |||
print("Error: Invalid option \"\(invalid)\"\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this print
be output to stderr instead of stdout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me... but is there an easier way to print to stderr than what I could figure out?
- Provides usage and examples on --help, -h, or and invalid option - Examples are customized based on the tests contained in the executable and the executable name For example, for Foundation's TestFoundation: ``` > TestFoundation --invalid Error: Invalid option "--invalid" Usage: TestFoundation.exe [OPTION] TestFoundation.exe [TESTCASE] Run and report results of test cases. With no OPTION or TESTCASE, runs all test cases. -h, --help Print this help message -l, --list-test List tests line by line to standard output --dump-tests-json List tests in JSON to standard output Examples: Run a single test > TestFoundation.exe TestFoundation.TestAffineTransform/test_BasicConstruction Run all the tests in TestFoundation.TestAffineTransform > TestFoundation.exe TestFoundation.TestAffineTransform ```
@swift-ci please test |
Two week reminder ping :) cc @stmontgomery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay here @gmittert. This looks great to me! Thanks for this contribution.
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks @gmittert!
and the executable name
For example, for Foundation's TestFoundation: