-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Simplify TextProvider, Fix all @text ending with space #25
base: master
Are you sure you want to change the base?
Conversation
isn't the point of swallowing that exception to allow for an empty string? |
Wouldn't work: there's a break in the catch statement, causing first never Also, what's the use case? -- Above message was sent from my mobile phone. There may and will be all
|
right, so it breaks the while loop and the stringbuilder will have no elements, making the toString return "", which is a completely valid arg (assuming there's no non-empty validators) use case would be allowing an empty text arg. you could probably also use an @optional @text, but that allows it to be null afaik, meaning you need to check if it was specified or not. |
It breaks the while loop, first is true, so the condition on the if -- Above message was sent from my mobile phone. There may and will be all On 7 Aug 2016 02:32, "Wizjany" notifications@github.com wrote:
|
Ah, missed that check. Yes, both of the |
Having scanned these few lines on code so often in the past day, I doubt I'll check out the whole project and write a unit test to see if any of the -- Above message was sent from my mobile phone. There may and will be all On 7 Aug 2016 03:45, "Wizjany" notifications@github.com wrote:
|
This commit simplifies TextProvider to be a lot clearer and also avoid swallowing an unnecessary exception. Furthermore, it changes its behaviour so that created text does not always have a space at the end. Usually, people don't mean to add an unnecessary space at the end of their text argument if they don't put more text. The motivation for this commit is that I am currently experiencing the space problem in my usage of this library. Thanks!
Okay, actually, you were right. Both implementations do allow to specify empty text. However, this only works by having a trailing space at the end of the command line, which I doubt is something the average user would think of. Anyways, I provided unit tests for the behaviour of the class. They fail for the previous version because that one always ends the input with a space no matter what. From my point of view, that is clearly incorrect behaviour. As a developer, I would assume that if I pass The reason both implementations allow for empty strings (somewhat) is the way Java's Update: Here are the test results for old and new implementations, for reference. |
This PR simplifies TextProvider to be a lot clearer and also avoid swallowing an unnecessary exception.
Furthermore, it changes its behaviour so that created text does not always have a space at the end. Usually, people don't mean to add an unnecessary space at the end of their text argument if they don't put more text.
The motivation for this commit is that I am currently experiencing the space problem in my usage of this library.
Thanks!