Skip to content
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

[Fixes #260] Make space trimming consistent for all task arguments #259

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

grzuy
Copy link
Contributor

@grzuy grzuy commented Feb 23, 2018

Fixes #260

Given a task that just inspect task arguments...

Current rake behavior

$ bundle exec rake "inspect_args[  one  ,  two  ,  three  ]"
"  one"
"two"
"three"

With this PR changes

$ bundle exec rake "inspect_args[  one  ,  two  ,  three  ]"
"one"
"two"
"three"

@grzuy grzuy changed the title [Fixes #216] Make space trimming consistent for all task arguments [Fixes #260] Make space trimming consistent for all task arguments Feb 23, 2018
@grzuy grzuy force-pushed the fix_leading_whitespaces branch from 2ab7603 to 15f9169 Compare February 23, 2018 20:49
@grzuy
Copy link
Contributor Author

grzuy commented Mar 6, 2018

@hsbt @yuki24 Any feedback on this one? :-)

def test_can_handle_spaces_between_args
name, args = @app.parse_task_string("name[one, two,\tthree , \tfour]")
def test_can_handle_spaces_between_all_args
name, args = @app.parse_task_string("name[ one , two ,\tthree , \tfour ]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the existing test and add a new test as this is technically a new feature. Also, make sure it doesn't strip out whitespaces in a string literal:

rake name[one,two,three]     # => should be interpreted as `rake name[one,two,three]`
rake name[ one , two, three] # => should be interpreted as `rake name[one,two,three]`

rake name["one two",three]   # => should be interpreted as `rake name["one two",three]`
rake name[ "one two", three] # => should be interpreted as `rake name["one two",three]`

Copy link
Contributor Author

@grzuy grzuy Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback.

Added original test back.
Regarding your second comment, i think there's already a test case below testing that white-spaces embedded in arguments are not stripped out. Let me know if that covers it or not.

Added new commit, let me know if you prefer amend.

@grzuy grzuy force-pushed the fix_leading_whitespaces branch from 0e2cd0f to 7175910 Compare March 7, 2018 14:40
@hsbt hsbt merged commit 55bee9a into ruby:master Mar 8, 2018
@hsbt
Copy link
Member

hsbt commented Mar 8, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants