1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/date/test_date.rb (TestDate#test_coerce):

test for [ruby-core:35127].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2011-05-03 09:31:13 +00:00
parent 227609ea96
commit 7ad29955a6
2 changed files with 26 additions and 0 deletions

View file

@ -113,6 +113,27 @@ class TestDate < Test::Unit::TestCase
assert_equal(d2, dt2)
end
def test_coerce
bug4375 = '[ruby-core:35127]'
d = Date.jd(0)
d2 = Date.jd(1)
others = [1, d2, Date::Infinity.new, nil, Object.new]
assert_nothing_raised(bug4375) {
others.each do |o|
case o
when d
flunk("expected not to match")
end
end
}
assert_nothing_raised(bug4375) {
case d
when *others
flunk("expected not to match")
end
}
end
def test_hash
h = {}
h[Date.new(1999,5,23)] = 0