summaryrefslogtreecommitdiffhomepage
path: root/test/t/kernel.rb
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2020-05-24 01:25:03 +0900
committerYusuke Endoh <[email protected]>2020-05-24 01:25:03 +0900
commit6f4c585bd73fc43fb9e34a70d74b5a50852600ea (patch)
tree588252a0fdbd163af58a85b85b43804fd17a1935 /test/t/kernel.rb
parent47ea60814b61d6f52a71b4799b4143f59191ff82 (diff)
downloadmruby-6f4c585bd73fc43fb9e34a70d74b5a50852600ea.tar.gz
mruby-6f4c585bd73fc43fb9e34a70d74b5a50852600ea.zip
Do not destruct rest arguments for __send__
Formerly, `__send__(*args)` modified `args` with `Array#shift`. This bug affects optcarrot. This changeset avoids the array destruction by using `args = args[1, len-1]`.
Diffstat (limited to 'test/t/kernel.rb')
-rw-r--r--test/t/kernel.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/t/kernel.rb b/test/t/kernel.rb
index aac6373fa..e3b9fe8ab 100644
--- a/test/t/kernel.rb
+++ b/test/t/kernel.rb
@@ -100,6 +100,10 @@ assert('Kernel#__send__', '15.3.1.3.4') do
assert_true __send__(:respond_to?, :nil?)
# test without argument and without block
assert_equal String, __send__(:to_s).class
+
+ args = [:respond_to?, :nil?]
+ assert_true __send__(*args)
+ assert_equal [:respond_to?, :nil?], args
end
assert('Kernel#block_given?', '15.3.1.3.6') do