diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-04 05:30:08 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-04 05:30:08 +0000 |
commit | f587eab23cdb70890f233d02eea7186ac05a21b1 (patch) | |
tree | 8b5310a18e9f1a27914264a8940d368ac5b4c13d /test | |
parent | 7ef9aba753191632da2289e0d14f3bc1723816f6 (diff) | |
download | ruby-f587eab23cdb70890f233d02eea7186ac05a21b1.tar.gz |
* eval.c (rb_obj_respond_to): check the result of respond_to? method
by RTEST.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index c71be7d09d..70214c8ff5 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 |