diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-17 20:06:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 20:06:18 +0900 |
commit | 9908177857a28633d6279c43a1ad4dfedcb98596 (patch) | |
tree | 400f3c07584b9d87129ec24c42ccb436095f2803 /test/ruby/test_hash.rb | |
parent | d597d7a8b6e753cfe40b8470c770f744adde5d4f (diff) | |
download | ruby-9908177857a28633d6279c43a1ad4dfedcb98596.tar.gz |
test/ruby: Check warning messages at a finer granularity
Instead of suppressing all warnings wholly in each test scripts by
setting `$VERBOSE` to `nil` in `setup` methods.
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r-- | test/ruby/test_hash.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 91e14daf2c..0e0bd565b9 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -86,7 +86,6 @@ class TestHash < Test::Unit::TestCase 'nil' => nil ] @verbose = $VERBOSE - $VERBOSE = nil end def teardown @@ -947,7 +946,7 @@ class TestHash < Test::Unit::TestCase end def test_fetch2 - assert_equal(:bar, @h.fetch(0, :foo) { :bar }) + assert_equal(:bar, assert_warning(/block supersedes default value argument/) {@h.fetch(0, :foo) { :bar }}) end def test_default_proc @@ -1112,6 +1111,7 @@ class TestHash < Test::Unit::TestCase def o.to_hash; @cls[]; end def o.==(x); true; end assert_equal({}, o) + o.singleton_class.remove_method(:==) def o.==(x); false; end assert_not_equal({}, o) @@ -1128,6 +1128,7 @@ class TestHash < Test::Unit::TestCase def o.to_hash; @cls[]; end def o.eql?(x); true; end assert_send([@cls[], :eql?, o]) + o.singleton_class.remove_method(:eql?) def o.eql?(x); false; end assert_not_send([@cls[], :eql?, o]) end |