From 15f916938e3b43491647b6e353b7598f768290d2 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Fri, 23 Feb 2018 15:02:11 -0300 Subject: [PATCH] Make space trimming consistent for all task arguments. Fixes #260 --- lib/rake/application.rb | 2 +- test/test_rake_task_argument_parsing.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rake/application.rb b/lib/rake/application.rb index 8927d951b..c86cb1fa2 100644 --- a/lib/rake/application.rb +++ b/lib/rake/application.rb @@ -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') diff --git a/test/test_rake_task_argument_parsing.rb b/test/test_rake_task_argument_parsing.rb index fc494a463..fbe0273e7 100644 --- a/test/test_rake_task_argument_parsing.rb +++ b/test/test_rake_task_argument_parsing.rb @@ -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