diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-02 19:49:22 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-02 19:49:22 +0000 |
commit | a54da1c05058d9f873f28c317677c5393d7327c9 (patch) | |
tree | 6edb86d4e77240bdcf025647ea7bb49eaf7dfb1d /test/ruby/test_defined.rb | |
parent | 5bcae57c6f0c5270763737c058f091fa86d1ce8a (diff) |
* vm_insnhelper.c (vm_defined): check respond_to_missing?
at defined?(func()).
* test/ruby/test_defined.rb: add a test for this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_defined.rb')
-rw-r--r-- | test/ruby/test_defined.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb index 64757615ec..95a46ed984 100644 --- a/test/ruby/test_defined.rb +++ b/test/ruby/test_defined.rb @@ -223,6 +223,14 @@ class TestDefined < Test::Unit::TestCase def existing_method end + + def func_defined_existing_func + defined?(existing_method()) + end + + def func_defined_non_existing_func + defined?(non_existing_method()) + end end def test_method_by_respond_to_missing @@ -232,5 +240,12 @@ class TestDefined < Test::Unit::TestCase assert_equal(false, obj.called, bug_11211) assert_equal(nil, defined?(obj.non_existing_method), bug_11211) assert_equal(true, obj.called, bug_11211) + + bug_11212 = '[Bug #11212]' + obj = ExampleRespondToMissing.new + assert_equal("method", obj.func_defined_existing_func, bug_11212) + assert_equal(false, obj.called, bug_11212) + assert_equal(nil, obj.func_defined_non_existing_func, bug_11212) + assert_equal(true, obj.called, bug_11212) end end |