diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/date/test_date.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/date/test_date.rb b/test/date/test_date.rb index f2be9e24c4..47ce568408 100644 --- a/test/date/test_date.rb +++ b/test/date/test_date.rb @@ -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 |