summaryrefslogtreecommitdiff
path: root/test/rake/test_rake_task_arguments.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-11 21:35:01 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-11 21:35:01 +0000
commit9cadc95b28da1cf6ca8f802292d12cc96a4f2c2d (patch)
tree73280968d3426b31c5d0b9da1d3e558aa6f9fcb9 /test/rake/test_rake_task_arguments.rb
parent52c1331763d8b9b8d6362987e6f8847b65ed7f57 (diff)
* NEWS (with all sufficient information):
* lib/rake: Update to rake 10.1.0 * bin/rake: ditto. * test/rake: ditto. * NEWS: Update NEWS to include rake 10.1.0 and links to release notes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_rake_task_arguments.rb')
-rw-r--r--test/rake/test_rake_task_arguments.rb37
1 files changed, 35 insertions, 2 deletions
diff --git a/test/rake/test_rake_task_arguments.rb b/test/rake/test_rake_task_arguments.rb
index 7001a4a..061178e 100644
--- a/test/rake/test_rake_task_arguments.rb
+++ b/test/rake/test_rake_task_arguments.rb
@@ -26,8 +26,8 @@ class TestRakeTaskArguments < Rake::TestCase
end
def test_enumerable_behavior
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2 ,3])
- assert_equal [10, 20, 30], ta.collect { |k,v| v * 10 }.sort
+ ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
+ assert_equal [10, 20, 30], ta.map { |k, v| v * 10 }.sort
end
def test_named_args
@@ -85,4 +85,37 @@ class TestRakeTaskArguments < Rake::TestCase
ta.with_defaults({ "cc" => "default_val" })
assert_nil ta[:cc]
end
+
+ def test_all_and_extra_arguments_without_named_arguments
+ app = Rake::Application.new
+ _, args = app.parse_task_string("task[1,two,more]")
+ ta = Rake::TaskArguments.new([], args)
+ assert_equal [], ta.names
+ assert_equal ['1', 'two', 'more'], ta.to_a
+ assert_equal ['1', 'two', 'more'], ta.extras
+ end
+
+ def test_all_and_extra_arguments_with_named_arguments
+ app = Rake::Application.new
+ _, args = app.parse_task_string("task[1,two,more,still more]")
+ ta = Rake::TaskArguments.new([:first, :second], args)
+ assert_equal [:first, :second], ta.names
+ assert_equal "1", ta[:first]
+ assert_equal "two", ta[:second]
+ assert_equal ['1', 'two', 'more', 'still more'], ta.to_a
+ assert_equal ['more', 'still more'], ta.extras
+ end
+
+ def test_extra_args_with_less_than_named_arguments
+ app = Rake::Application.new
+ _, args = app.parse_task_string("task[1,two]")
+ ta = Rake::TaskArguments.new([:first, :second, :third], args)
+ assert_equal [:first, :second, :third], ta.names
+ assert_equal "1", ta[:first]
+ assert_equal "two", ta[:second]
+ assert_equal nil, ta[:third]
+ assert_equal ['1', 'two'], ta.to_a
+ assert_equal [], ta.extras
+ end
+
end