diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-29 02:01:19 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-29 02:01:19 +0000 |
commit | 5b74e4f09ef4f10e5574a02f26a893569c99c945 (patch) | |
tree | 2c6409e383147ec0cf977e3526d9a4bfd28c493a /test/ruby | |
parent | 934f537b458778f4786716c95b73fc72bc1ce256 (diff) | |
download | ruby-5b74e4f09ef4f10e5574a02f26a893569c99c945.tar.gz |
* vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevel
private constant has been prohibited incorrectly.
* test/ruby/test_module.rb (test_toplevel_private_constant): add a
test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_module.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index c7acac05f9..ce6e8a66bb 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -985,4 +985,19 @@ class TestModule < Test::Unit::TestCase def test_constants_with_private_constant assert(!(::TestModule).constants.include?(:PrivateClass)) end + + def test_toplevel_private_constant + src = <<-INPUT + class Object + private_constant :Object + end + p Object + begin + p ::Object + rescue + p :ok + end + INPUT + assert_in_out_err([], src, %w(Object :ok), []) + end end |