Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a test for years close to 0 for Date
* it is problematic with Joda-Time since JulianChronology does not accept a year 0
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'test/unit' | ||
require 'date' | ||
|
||
class TestDateJodaTime < Test::Unit::TestCase | ||
def test_years_around_0 | ||
(-2..2).each do |year| | ||
assert_equal year, Date.new(year).year | ||
assert_equal year, DateTime.new(year).year | ||
[Date::GREGORIAN, Date::ITALY, Date::ENGLAND, Date::JULIAN].each do |sg| | ||
assert_equal year, Date.new(year, 1, 1, sg).year | ||
assert_equal year, DateTime.new(year, 1, 1, 0, 0, 0, 0, sg).year | ||
end | ||
end | ||
end | ||
end |