diff options
author | Jeremy Evans <[email protected]> | 2019-08-25 10:01:13 -0700 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2019-10-24 18:39:04 +0900 |
commit | fc0e8d00bc50ac8646b37adee3b599c83ce84a41 (patch) | |
tree | 23574e4a4c71ef4792520454f0ce9036bb0da021 /test/date | |
parent | 4e40ca301cca692361627ac6db06c0f0074636f0 (diff) |
[ruby/date] Support -Float::INFINITY...date ranges
Fixes Ruby Bug 12961
https://github.com/ruby/date/commit/7f533c2552
Diffstat (limited to 'test/date')
-rw-r--r-- | test/date/test_date.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/date/test_date.rb b/test/date/test_date.rb index 03e935e299..ebd75ae12d 100644 --- a/test/date/test_date.rb +++ b/test/date/test_date.rb @@ -6,6 +6,19 @@ class DateSub < Date; end class DateTimeSub < DateTime; end class TestDate < Test::Unit::TestCase + def test_range_infinite_float + today = Date.today + r = today...Float::INFINITY + assert_equal today, r.begin + assert_equal Float::INFINITY, r.end + assert_equal true, r.cover?(today+1) + assert_equal false, r.cover?(today-1) + r = (-Float::INFINITY)...today + assert_equal(-Float::INFINITY, r.begin) + assert_equal today, r.end + assert_equal false, r.cover?(today+1) + assert_equal true, r.cover?(today-1) + end def test__const assert_nil(Date::MONTHNAMES[0]) |