diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-03 11:52:08 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-03 11:52:08 +0000 |
commit | d267b2e347b0ef226c132a881ed11a89e622df24 (patch) | |
tree | 3e89f74f8f00985d506a3f685c0de151fbefd8a9 /test | |
parent | 53df70d92b8073dc5602aff912b657869c4d7524 (diff) | |
download | ruby-d267b2e347b0ef226c132a881ed11a89e622df24.tar.gz |
* variable.c (set_const_visibility): Module#private_constant has
changed the visibility of only the first argument. Now it changes
all of them. [ruby-list:48558]
* test/ruby/test_module.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_module.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 892ab9f593..16485c30d1 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1070,6 +1070,19 @@ class TestModule < Test::Unit::TestCase assert_raise(NameError) { c::FOO } end + def test_private_constant2 + c = Class.new + c.const_set(:FOO, "foo") + c.const_set(:BAR, "bar") + assert_equal("foo", c::FOO) + assert_equal("bar", c::BAR) + c.private_constant(:FOO, :BAR) + assert_raise(NameError) { c::FOO } + assert_raise(NameError) { c::BAR } + assert_equal("foo", c.class_eval("FOO")) + assert_equal("bar", c.class_eval("BAR")) + end + class PrivateClass end private_constant :PrivateClass |