-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SwiftSyntaxTest: refactor command-line argument parsing into a test utility module. NFC #18418
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 smoke 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.
Looks good overall. I knew this was going to come up so thanks for tackling it.
Some minor accessibility comments below.
let argName: String | ||
|
||
var errorDescription: String? { | ||
return "Missing required argument: \(argName)" | ||
} | ||
} | ||
struct UnkeyedArgumentError: LocalizedError { | ||
fileprivate struct UnkeyedArgumentError: LocalizedError { |
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.
IMHO this should be public
so that you can specifically catch the error. Same goes for MissingArgumentError
.
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.
Ok, will update!
let argName: String | ||
|
||
var errorDescription: String? { | ||
return "Unexpectedly found command line argument \(argName) without a key" | ||
} | ||
} | ||
|
||
private let args: [String: String] | ||
fileprivate let args: [String: String] |
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.
Is there any reason why this an no longer be private
?
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.
Not specifically; keeping it as private
should be good enough.
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.
I always default to private
because its less verbose and the stricter access level.
@swift-ci please smoke test |
@ahoppen do you mind if we change the flag style from "--flag" to "-flag" to match the conventions? |
No, I don't have strong opinions on this. |
@swift-ci please smoke test |
…tility module. NFC (swiftlang#18418)
No description provided.