mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
* variable.c (set_const_visibility): clear inine-cache when constant's
visibility is modified. [ruby-dev:44929] * test/ruby/test_module.rb (test_private_constants_clear_inlinecache): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f6a2a43116
commit
1fd41dce10
3 changed files with 38 additions and 3 deletions
|
@ -1130,6 +1130,27 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_in_out_err([], src, %w(Object :ok), [])
|
||||
end
|
||||
|
||||
def test_private_constants_clear_inlinecache
|
||||
bug5702 = '[ruby-dev:44929]'
|
||||
src = <<-INPUT
|
||||
class A
|
||||
C = :Const
|
||||
def self.get_C
|
||||
A::C
|
||||
end
|
||||
# fill cache
|
||||
A.get_C
|
||||
private_constant :C, :D rescue nil
|
||||
begin
|
||||
A.get_C
|
||||
rescue NameError
|
||||
puts "A.get_C"
|
||||
end
|
||||
end
|
||||
INPUT
|
||||
assert_in_out_err([], src, %w(A.get_C), [], bug5702)
|
||||
end
|
||||
|
||||
def test_constant_lookup_in_method_defined_by_class_eval
|
||||
src = <<-INPUT
|
||||
class A
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue