diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-25 20:29:15 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-25 20:29:15 +0000 |
commit | 0ef94bd2afa035648032e382201f1c9af29c5c3a (patch) | |
tree | 2ece6c9bf074ba2bcaacc64220a1a30c0dc7e4ec /test/ruby/test_module.rb | |
parent | e0f02160bcb09a1cef051b59da52432082adfc6f (diff) | |
download | ruby-0ef94bd2afa035648032e382201f1c9af29c5c3a.tar.gz |
object.c (rb_class_real): do not dereference 0 VALUE
* test/ruby/test_module.rb (test_inspect_segfault):
Test case and bug report by Thomas Stratmann.
[ruby-core:65214] [Bug #10282]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index ce5ab2ff73..f025c1948e 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1971,6 +1971,30 @@ class TestModule < Test::Unit::TestCase } end + def test_inspect_segfault + bug_10282 = '[ruby-core:65214] [Bug #10282]' + assert_separately [], <<-RUBY + module ShallowInspect + def shallow_inspect + "foo" + end + end + + module InspectIsShallow + include ShallowInspect + alias_method :inspect, :shallow_inspect + end + + class A + end + + A.prepend InspectIsShallow + + expect = "#<Method: A(Object)#inspect(shallow_inspect)>" + assert_equal expect, A.new.method(:inspect).inspect, "#{bug_10282}" + RUBY + end + private def assert_top_method_is_private(method) |