summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-11 21:23:47 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-11 21:23:47 +0000
commitad558ae184116f7c3806c0f420f0ed6a864f9373 (patch)
tree5057211a56430eff023a68f99b14892edd13aeff /test
parent6a2bd5fcb68568e4b5d8992c0107c7d4338fa958 (diff)
merges r30856 from trunk into ruby_1_9_2.
-- * lib/date.rb (Date#===): [ruby-core:35127] -- * test/date/test_date.rb (TestDate#test_coerce): test for [ruby-core:35127]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/date/test_date.rb21
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