1require File.expand_path('../helper', __FILE__) 2 3class TestRakeTaskManagerArgumentResolution < Rake::TestCase 4 5 def setup 6 super 7 8 Rake.application.options.ignore_deprecate = true 9 end 10 11 def teardown 12 Rake.application.options.ignore_deprecate = false 13 14 super 15 end 16 17 def test_good_arg_patterns 18 assert_equal [:t, [], []], task(:t) 19 assert_equal [:t, [], [:x]], task(:t => :x) 20 assert_equal [:t, [], [:x, :y]], task(:t => [:x, :y]) 21 22 assert_equal [:t, [:a, :b], []], task(:t, :a, :b) 23 assert_equal [:t, [], [:x]], task(:t, :needs => :x) 24 assert_equal [:t, [:a, :b], [:x]], task(:t, :a, :b, :needs => :x) 25 assert_equal [:t, [:a, :b], [:x, :y]], task(:t, :a, :b, :needs => [:x, :y]) 26 27 assert_equal [:t, [:a, :b], []], task(:t, [:a, :b]) 28 assert_equal [:t, [:a, :b], [:x]], task(:t, [:a, :b] => :x) 29 assert_equal [:t, [:a, :b], [:x, :y]], task(:t, [:a, :b] => [:x, :y]) 30 end 31 32 def task(*args) 33 tm = Rake::TestCase::TaskManager.new 34 tm.resolve_args(args) 35 end 36end 37