aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-10 16:54:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-10 16:54:47 +0000
commit3f58f034b62ef6d3150c1d04ad9ea69090846bf6 (patch)
treeba3749046e859a91710c9d1ae584e96c9659a30a /test
parentfcbd41230f228af3a58c6ab53832a8988e760074 (diff)
downloadruby-3f58f034b62ef6d3150c1d04ad9ea69090846bf6.tar.gz
insns.def: cache nil const
* insns.def (getinlinecache): Qnil is a valid value as a constant. this can be observable when accessing a deprecated constant which is nil. non-nil constant is warned just once for each location, but every time if it is nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 9980844eb4..1b04b954af 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1429,6 +1429,17 @@ class TestModule < Test::Unit::TestCase
assert_warn(/deprecated/, bug12382) {c.class_eval "FOO"}
end
+ NIL = nil
+ FALSE = false
+ deprecate_constant(:NIL, :FALSE)
+
+ def test_deprecate_nil_constant
+ w = EnvUtil.verbose_warning {2.times {FALSE}}
+ assert_equal(1, w.scan("::FALSE").size, w)
+ w = EnvUtil.verbose_warning {2.times {NIL}}
+ assert_equal(1, w.scan("::NIL").size, w)
+ end
+
def test_constants_with_private_constant
assert_not_include(::TestModule.constants, :PrivateClass)
assert_not_include(::TestModule.constants(true), :PrivateClass)