/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

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