diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-23 06:53:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-23 06:53:51 +0000 |
commit | c25c84777cf0bc96a0b985ca1ffda09aa8052d24 (patch) | |
tree | e799a7fe13f58635f10576e25c5d039abecd6d80 /test | |
parent | 21e74f54816b147c0515d0f6c019d3e87fb237d2 (diff) | |
download | ruby-c25c84777cf0bc96a0b985ca1ffda09aa8052d24.tar.gz |
hash.c: reduce warning
* hash.c (HAS_EXTRA_STATES): warn extra states only when something
differ. [ruby-core:59254] [Bug #9275]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_hash.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index da4871eab9..8e0de3cc5d 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -558,12 +558,22 @@ class TestHash < Test::Unit::TestCase assert_equal(h3, h.reject {|k,v| v }) assert_equal(base, h) - return unless RUBY_VERSION > "2.1.0" + unless RUBY_VERSION > "2.1.0" + if @cls == Hash + assert_empty(EnvUtil.verbose_warning {h.reject {false}}) + bug9275 = '[ruby-core:59254] [Bug #9275]' + c = Class.new(Hash) + assert_empty(EnvUtil.verbose_warning {c.new.reject {false}}, bug9275) + else + assert_match(/extra states/, EnvUtil.verbose_warning {h.reject {false}}) + end + return + end h.instance_variable_set(:@foo, :foo) h.default = 42 h.taint - h = h.reject {false} + h = EnvUtil.suppress_warning {h.reject {false}} assert_instance_of(Hash, h) assert_not_predicate(h, :tainted?) assert_nil(h.default) @@ -1219,6 +1229,9 @@ class TestHash < Test::Unit::TestCase class TestSubHash < TestHash class SubHash < Hash + def reject(*) + super + end end def setup |