summaryrefslogtreecommitdiff
path: root/test/ruby/test_call.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_call.rb')
-rw-r--r--test/ruby/test_call.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index ced1eaf5e9..570b5bb0a9 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -303,7 +303,7 @@ class TestCall < Test::Unit::TestCase
assert_syntax_error(%q{h[*a, 2, b: 5, **kw] += 1}, message)
end
- def test_call_splat_order
+ def test_call_splat_post_order
bug12860 = '[ruby-core:77701] [Bug# 12860]'
ary = [1, 2]
assert_equal([1, 2, 1], aaa(*ary, ary.shift), bug12860)
@@ -311,7 +311,7 @@ class TestCall < Test::Unit::TestCase
assert_equal([0, 1, 2, 1], aaa(0, *ary, ary.shift), bug12860)
end
- def test_call_block_order
+ def test_call_splat_block_order
bug16504 = '[ruby-core:96769] [Bug# 16504]'
b = proc{}
ary = [1, 2, b]
@@ -320,6 +320,22 @@ class TestCall < Test::Unit::TestCase
assert_equal([0, 1, 2, b], aaa(0, *ary, &ary.pop), bug16504)
end
+ def test_call_splat_kw_order
+ b = {}
+ ary = [1, 2, b]
+ assert_equal([1, 2, b, {a: b}], aaa(*ary, a: ary.pop))
+ ary = [1, 2, b]
+ assert_equal([0, 1, 2, b, {a: b}], aaa(0, *ary, a: ary.pop))
+ end
+
+ def test_call_splat_kw_splat_order
+ b = {}
+ ary = [1, 2, b]
+ assert_equal([1, 2, b], aaa(*ary, **ary.pop))
+ ary = [1, 2, b]
+ assert_equal([0, 1, 2, b], aaa(0, *ary, **ary.pop))
+ end
+
def test_call_args_splat_with_nonhash_keyword_splat
o = Object.new
def o.to_hash; {a: 1} end