Skip to content

Commit 00aacdc

Browse files
committedSep 27, 2019
Fix an incorrectly resolved arg pattern
1 parent d8aba43 commit 00aacdc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
 

‎lib/rake/task_manager.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def resolve_args_with_dependencies(args, hash) # :nodoc:
133133
deps = value || []
134134
else
135135
task_name = args.shift
136-
arg_names = key
137-
deps = value
136+
arg_names = key || args.shift|| []
137+
deps = value || []
138138
end
139139
deps = [deps] unless deps.respond_to?(:to_ary)
140140
[task_name, arg_names, deps, order_only]

‎test/test_rake_task_manager_argument_resolution.rb

+7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ def test_good_arg_patterns
88
assert_equal [:t, [], [:x], nil], task(t: :x)
99
assert_equal [:t, [], [:x, :y], nil], task(t: [:x, :y])
1010

11+
assert_equal [:t, [], [], [:m]], task(:t, order_only: [:m])
12+
assert_equal [:t, [], [:x, :y], [:m, :n]], task(t: [:x, :y], order_only: [:m, :n])
13+
1114
assert_equal [:t, [:a, :b], [], nil], task(:t, [:a, :b])
1215
assert_equal [:t, [:a, :b], [:x], nil], task(:t, [:a, :b] => :x)
1316
assert_equal [:t, [:a, :b], [:x, :y], nil], task(:t, [:a, :b] => [:x, :y])
17+
18+
assert_equal [:t, [:a, :b], [], [:m]], task(:t, [:a, :b], order_only: [:m])
19+
assert_equal [:t, [:a, :b], [:x], [:m]], task(:t, [:a, :b] => :x, order_only: [:m])
20+
assert_equal [:t, [:a, :b], [:x, :y], [:m, :n]], task(:t, [:a, :b] => [:x, :y], order_only: [:m, :n])
1421
end
1522

1623
def task(*args)

0 commit comments

Comments
 (0)