From b2a4cea3b95d89b8cb42df5fb269fc687ca19abe Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 2 Dec 2017 10:54:39 +0000 Subject: Modules should not have subclasses. When refining a module, the module was set to the superclass of its refinement, and a segmentation fault occurred. The superclass of the refinement should be an iclass of the module. [ruby-core:83617] [Bug #14070] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_refinement.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index d489404fff..3aab6e4f1e 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -2036,6 +2036,25 @@ class TestRefinement < Test::Unit::TestCase INPUT end + def test_refining_module_repeatedly + bug14070 = '[ruby-core:83617] [Bug #14070]' + assert_in_out_err([], <<-INPUT, ["ok"], [], bug14070) + 1000.times do + Class.new do + include Enumerable + end + + Module.new do + refine Enumerable do + def foo + end + end + end + end + puts "ok" + INPUT + end + private def eval_using(mod, s) -- cgit v1.2.3