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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rake/application.rb
Expand Up @@ -172,7 +172,7 @@ def parse_task_string(string) # :nodoc:
args = []

begin
/((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
/\s*((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args

remaining_args = $2
args << $1.gsub(/\\(.)/, '\1')
Expand Down
6 changes: 6 additions & 0 deletions test/test_rake_task_argument_parsing.rb
Expand Up @@ -38,6 +38,12 @@ def test_can_handle_spaces_between_args
assert_equal ["one", "two", "three", "four"], args
end

def test_can_handle_spaces_between_all_args
name, args = @app.parse_task_string("name[ one , two ,\tthree , \tfour ]")
assert_equal "name", name
assert_equal ["one", "two", "three", "four"], args
end

def test_keeps_embedded_spaces
name, args = @app.parse_task_string("name[a one ana, two]")
assert_equal "name", name
Expand Down