diff options
author | a_matsuda <a_matsuda@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-12 12:12:38 +0000 |
---|---|---|
committer | a_matsuda <a_matsuda@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-12 12:12:38 +0000 |
commit | 6cc0bbebc591566d18cd02887b0d5147c063638a (patch) | |
tree | d21854637432b33b035866c8bf21bae64565f75b | |
parent | bdab045a758932b99c093c545b56d0d3d22d42bd (diff) | |
download | ruby-6cc0bbebc591566d18cd02887b0d5147c063638a.tar.gz |
Add Method#=== that invokes #call
Patch by osyo via [Feature #14142]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | proc.c | 1 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 6 |
2 files changed, 7 insertions, 0 deletions
@@ -3124,6 +3124,7 @@ Init_Proc(void) rb_define_method(rb_cMethod, "hash", method_hash, 0); rb_define_method(rb_cMethod, "clone", method_clone, 0); rb_define_method(rb_cMethod, "call", rb_method_call, -1); + rb_define_method(rb_cMethod, "===", rb_method_call, -1); rb_define_method(rb_cMethod, "curry", rb_method_curry, -1); rb_define_method(rb_cMethod, "[]", rb_method_call, -1); rb_define_method(rb_cMethod, "arity", method_arity_m, 0); diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 778fcdc9bc..b3d4098a1c 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -1017,4 +1017,10 @@ class TestMethod < Test::Unit::TestCase # without trace insn assert_separately [], "RubyVM::InstructionSequence.compile_option = {trace_instruction: false}\n" + body end + + def test_eqq + assert(Method.instance_methods(false).include? :===) + assert_operator(0.method(:<), :===, 5) + assert_not_operator(0.method(:<), :===, -5) + end end |