PageRenderTime 212ms CodeModel.GetById 197ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.9.2/test/test_rake_task_manager_argument_resolution.rb

http://github.com/agross/netopenspace
Ruby | 36 lines | 27 code | 9 blank | 0 comment | 0 complexity | ff1b5443afb6d0745bf525ae8f845114 MD5 | raw file
 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