Made the warning for deprecated constants follow the category flag

This commit is contained in:
Nobuyoshi Nakada 2019-12-17 14:52:15 +09:00
parent 76035e5bb6
commit 9bf9de3d9d
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
4 changed files with 28 additions and 9 deletions

View file

@ -28,10 +28,13 @@ class TestModule < Test::Unit::TestCase
def setup
@verbose = $VERBOSE
$VERBOSE = nil
@deprecated = Warning[:deprecated]
Warning[:deprecated] = true
end
def teardown
$VERBOSE = @verbose
Warning[:deprecated] = @deprecated
end
def test_LT_0
@ -1580,6 +1583,8 @@ class TestModule < Test::Unit::TestCase
assert_warn(/#{c}::FOO is deprecated/) {Class.new(c)::FOO}
bug12382 = '[ruby-core:75505] [Bug #12382]'
assert_warn(/deprecated/, bug12382) {c.class_eval "FOO"}
Warning[:deprecated] = false
assert_warn('') {c::FOO}
end
NIL = nil