From 1f8b6187955332e212b0c2c073c7965d44c389e0 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 4 May 2008 05:30:08 +0000 Subject: * eval.c (rb_obj_respond_to): check the result of respond_to? method by RTEST. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_string.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby/test_string.rb') diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index c71be7d09..70214c8ff 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1403,4 +1403,12 @@ class TestString < Test::Unit::TestCase s1 << 'a' } end + + def test_respond_to + o = Object.new + def o.respond_to?(arg) [:to_str].include?(arg) ? nil : super end + def o.to_str() "" end + def o.==(other) "" == other end + assert_equal(false, "" == o) + end end -- cgit