Skip to content

Commit 55bee9a

Browse files
authored
Merge pull request #259 from grzuy/fix_leading_whitespaces
[Fixes #260] Make space trimming consistent for all task arguments
2 parents d56ee71 + 7175910 commit 55bee9a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/rake/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def parse_task_string(string) # :nodoc:
172172
args = []
173173

174174
begin
175-
/((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
175+
/\s*((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
176176

177177
remaining_args = $2
178178
args << $1.gsub(/\\(.)/, '\1')

test/test_rake_task_argument_parsing.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def test_can_handle_spaces_between_args
3838
assert_equal ["one", "two", "three", "four"], args
3939
end
4040

41+
def test_can_handle_spaces_between_all_args
42+
name, args = @app.parse_task_string("name[ one , two ,\tthree , \tfour ]")
43+
assert_equal "name", name
44+
assert_equal ["one", "two", "three", "four"], args
45+
end
46+
4147
def test_keeps_embedded_spaces
4248
name, args = @app.parse_task_string("name[a one ana, two]")
4349
assert_equal "name", name

0 commit comments

Comments
 (0)