test/ruby: suppress some warnings
follow up to 9908177857a28633d6279c43a1ad4dfedcb98596
This commit is contained in:
parent
980f994b3b
commit
caef364cc5
@ -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)
|
||||
|
@ -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))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user