diff options
Diffstat (limited to 'test')
-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) |