Skip to content

Commit

Permalink
Fix an incorrectly resolved arg pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbellantoni committed Sep 27, 2019
1 parent d8aba43 commit 00aacdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rake/task_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ def resolve_args_with_dependencies(args, hash) # :nodoc:
deps = value || []
else
task_name = args.shift
arg_names = key
deps = value
arg_names = key || args.shift|| []
deps = value || []
end
deps = [deps] unless deps.respond_to?(:to_ary)
[task_name, arg_names, deps, order_only]
Expand Down
7 changes: 7 additions & 0 deletions test/test_rake_task_manager_argument_resolution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ def test_good_arg_patterns
assert_equal [:t, [], [:x], nil], task(t: :x)
assert_equal [:t, [], [:x, :y], nil], task(t: [:x, :y])

assert_equal [:t, [], [], [:m]], task(:t, order_only: [:m])
assert_equal [:t, [], [:x, :y], [:m, :n]], task(t: [:x, :y], order_only: [:m, :n])

assert_equal [:t, [:a, :b], [], nil], task(:t, [:a, :b])
assert_equal [:t, [:a, :b], [:x], nil], task(:t, [:a, :b] => :x)
assert_equal [:t, [:a, :b], [:x, :y], nil], task(:t, [:a, :b] => [:x, :y])

assert_equal [:t, [:a, :b], [], [:m]], task(:t, [:a, :b], order_only: [:m])
assert_equal [:t, [:a, :b], [:x], [:m]], task(:t, [:a, :b] => :x, order_only: [:m])
assert_equal [:t, [:a, :b], [:x, :y], [:m, :n]], task(:t, [:a, :b] => [:x, :y], order_only: [:m, :n])
end

def task(*args)
Expand Down

0 comments on commit 00aacdc

Please sign in to comment.