diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-26 14:58:41 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-26 14:58:41 +0000 |
commit | a669f1f992105981efd4bb891d34cbf53b05696a (patch) | |
tree | 1b75d3c5f376bd54a51e26a837d3771e7632b979 /test/ruby/test_module.rb | |
parent | dce01373fd866e8ac77ed3d3b1b148044d2259af (diff) |
merge revision(s) 56117,56118: [Backport #12742]
* variable.c (rb_const_search): raise with the actual class/module
name which defines the private constant.
* variable.c (rb_const_search): warn with the actual class/module
name which defines the deprecated constant.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r-- | test/ruby/test_module.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 06744b5249..b155ad7206 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1362,6 +1362,9 @@ class TestModule < Test::Unit::TestCase c.const_set(:FOO, "foo") $VERBOSE = verbose assert_raise(NameError) { c::FOO } + assert_raise_with_message(NameError, /#{c}::FOO/) do + Class.new(c)::FOO + end end def test_private_constant2 @@ -1419,6 +1422,7 @@ class TestModule < Test::Unit::TestCase c.const_set(:FOO, "foo") c.deprecate_constant(:FOO) assert_warn(/deprecated/) {c::FOO} + assert_warn(/#{c}::FOO is deprecated/) {Class.new(c)::FOO} bug12382 = '[ruby-core:75505] [Bug #12382]' assert_warn(/deprecated/, bug12382) {c.class_eval "FOO"} end |