summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb15
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