ruby-changes:64247
From: Yusuke <ko1@a...>
Date: Thu, 17 Dec 2020 22:54:26 +0900 (JST)
Subject: [ruby-changes:64247] caef364cc5 (master): test/ruby: suppress some warnings
https://git.ruby-lang.org/ruby.git/commit/?id=caef364cc5 From caef364cc5e9816b398f46a7da50057707f87af3 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 17 Dec 2020 22:39:37 +0900 Subject: test/ruby: suppress some warnings follow up to 9908177857a28633d6279c43a1ad4dfedcb98596 diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 0e0bd56..c4b9383 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -877,7 +877,7 @@ class TestHash < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L877 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_hash.rb#L1770 @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 a2867f0..4c24c28 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -420,8 +420,10 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L420 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L713 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)) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/