summaryrefslogtreecommitdiff
path: root/test/ruby/test_refinement.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 03:23:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 03:23:43 +0000
commit217f599a1e1c09618b0ebeffb34be790f70b8c68 (patch)
tree1cf6c97d0fff0928365e6d4cae5fc4e535569238 /test/ruby/test_refinement.rb
parent19a1f70364ccabaace321d492d35a99ad9053423 (diff)
class.c: prohibit refinement module
* class.c (ensure_includable): cannot include refinement module, or the type and the class do not match. [ruby-core:79632] [Bug #13236] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_refinement.rb')
-rw-r--r--test/ruby/test_refinement.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index f6e08729d7..82bdb49659 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1886,6 +1886,20 @@ class TestRefinement < Test::Unit::TestCase
assert_equal("Parent -> Child", SuperToModule::Child.test, bug)
end
+ def test_include_refinement
+ bug = '[ruby-core:79632] [Bug #13236] cannot include refinement module'
+ r = nil
+ m = Module.new do
+ r = refine(String) {def test;:ok end}
+ end
+ assert_raise_with_message(ArgumentError, /refinement/, bug) do
+ m.module_eval {include r}
+ end
+ assert_raise_with_message(ArgumentError, /refinement/, bug) do
+ m.module_eval {prepend r}
+ end
+ end
+
private
def eval_using(mod, s)