From 83cd51e3fe6e1e2be1375602274caa6ae0ac2a86 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 30 Jul 2015 04:20:00 +0000 Subject: variable.c: Module#deprecate_constant * variable.c (rb_const_get_0): warn deprecated constant reference. * variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_module.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 5fc3d4a541..812b7f6a31 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1360,6 +1360,13 @@ class TestModule < Test::Unit::TestCase assert_equal("foo", c::FOO) end + def test_deprecate_constant + c = Class.new + c.const_set(:FOO, "foo") + c.deprecate_constant(:FOO) + assert_warn(/deprecated/) {c::FOO} + end + def test_constants_with_private_constant assert_not_include(::TestModule.constants, :PrivateClass) end -- cgit v1.2.3