-
Notifications
You must be signed in to change notification settings - Fork 277
[#7446] Handle special characters followed by digits in http-client-java's CodeNamer.getEnumMemberName #7448
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,12 @@ public void testEnumMemberName() { | |
|
||
Assertions.assertEquals("ONE_ZEROMINUTELY", CodeNamer.getEnumMemberName("_10minutely")); | ||
|
||
Assertions.assertEquals("DOLLAR_SIGN_100_GIFT_CARD", CodeNamer.getEnumMemberName("$100 Gift Card")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, without the fix the output would be There is 2 concern from me, on the output.
I am of pretty weak opinion on item (1), but I would like to see if we had something consistent for item (2). BTW, if one uses TypeSpec, one would have the option to explicitly write the name of the enum, thus avoid this logic to infer the var name. |
||
|
||
Assertions.assertEquals("PERCENT_SIGN_50_OFF", CodeNamer.getEnumMemberName("%50 Off")); | ||
|
||
Assertions.assertEquals("NUMBER_SIGN_10_TRENDING", CodeNamer.getEnumMemberName("#10 Trending")); | ||
|
||
Assertions.assertEquals("_", CodeNamer.getEnumMemberName("_")); | ||
} | ||
} |
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 could add
name.length() >= 2
if that is more readable/less of an index out of bounds mind phrack