diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-12-17 22:39:37 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-12-17 22:39:37 +0900 |
commit | caef364cc5e9816b398f46a7da50057707f87af3 (patch) | |
tree | 8bf53fbea4bd854e43aebfc20874925f9a200cee /test/ruby | |
parent | 980f994b3b349486c5e64b51241330d4c9fc63f1 (diff) | |
download | ruby-caef364cc5e9816b398f46a7da50057707f87af3.tar.gz |
test/ruby: suppress some warnings
follow up to 9908177857a28633d6279c43a1ad4dfedcb98596
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_hash.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_time.rb | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 0e0bd565b9..c4b93836c6 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -877,7 +877,7 @@ class TestHash < Test::Unit::TestCase def test_to_s h = @cls[ 1 => 2, "cat" => "dog", 1.5 => :fred ] assert_equal(h.inspect, h.to_s) - $, = ":" + assert_deprecated_warning { $, = ":" } assert_equal(h.inspect, h.to_s) h = @cls[] assert_equal(h.inspect, h.to_s) @@ -1770,6 +1770,12 @@ class TestHash < Test::Unit::TestCase @cls = SubHash super end + + def test_reject + assert_warning(/extra states are no longer copied/) do + super + end + end end ruby2_keywords def get_flagged_hash(*args) diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index a2867f0253..4c24c28c97 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -420,8 +420,10 @@ class TestTime < Test::Unit::TestCase def o.to_int; 0; end def o.to_r; nil; end assert_raise(TypeError) { Time.gm(2000, 1, 1, 0, 0, o, :foo, :foo) } + class << o; remove_method(:to_r); end def o.to_r; ""; end assert_raise(TypeError) { Time.gm(2000, 1, 1, 0, 0, o, :foo, :foo) } + class << o; remove_method(:to_r); end def o.to_r; Rational(11); end assert_equal(11, Time.gm(2000, 1, 1, 0, 0, o).sec) o = Object.new @@ -711,7 +713,9 @@ class TestTime < Test::Unit::TestCase assert_equal("12:00:00 AM", t2000.strftime("%r")) assert_equal("Sat 2000-01-01T00:00:00", t2000.strftime("%3a %FT%T")) - assert_equal("", t2000.strftime("")) + assert_warning(/strftime called with empty format string/) do + assert_equal("", t2000.strftime("")) + end assert_equal("foo\0bar\x0000\x0000\x0000", t2000.strftime("foo\0bar\0%H\0%M\0%S")) assert_equal("foo" * 1000, t2000.strftime("foo" * 1000)) |