1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (rb_mod_using): raise an ArgumentError if cyclic using is

detected.  based on the patch by Charlie Somerville.
  [ruby-core:49092] Bug #7308

* test/ruby/test_refinement.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-11-13 09:05:18 +00:00
parent e7659bd2fd
commit 684aa1f985
3 changed files with 50 additions and 0 deletions

View file

@ -801,4 +801,25 @@ class TestRefinement < Test::Unit::TestCase
p c.foo
INPUT
end
def test_circular_using_is_not_allowed
a = Module.new
b = Module.new
assert_raise ArgumentError do
a.module_eval do
using a
end
end
b.module_eval do
using a
end
assert_raise ArgumentError do
a.module_eval do
using b
end
end
end
end