Skip to content

Commit

Permalink
Make space trimming consistent for all task arguments. Fixes #260
Browse files Browse the repository at this point in the history
  • Loading branch information
grzuy committed Feb 23, 2018
1 parent 25c29b6 commit 15f9169
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rake/application.rb
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions test/test_rake_task_argument_parsing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def test_two_arguments
assert_equal ["one", "two"], args
end

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 ]")
assert_equal "name", name
assert_equal ["one", "two", "three", "four"], args
end
Expand Down

0 comments on commit 15f9169

Please sign in to comment.