diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-30 04:20:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-30 04:20:00 +0000 |
commit | 8c1a4a59c651bd49ba3801d25235973fd402973c (patch) | |
tree | e2d59d7870dbc9b8e83c5af528bbaa709df41cc4 /test/ruby/test_module.rb | |
parent | 54a33b84ed87d4a832c4bd8c102262aec1e35651 (diff) | |
download | ruby-8c1a4a59c651bd49ba3801d25235973fd402973c.tar.gz |
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
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 |