Skip to content

Commit

Permalink
add a test for years close to 0 for Date
Browse files Browse the repository at this point in the history
* it is problematic with Joda-Time since JulianChronology does not accept a year 0
  • Loading branch information
eregon authored and BanzaiMan committed Oct 1, 2013
1 parent dc5bd22 commit 47e7cb5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/jruby.1.9.index
Expand Up @@ -16,6 +16,7 @@ test_comparable
test_core_arities
test_custom_enumerable
test_cvars_in_odd_scopes
test_date_joda_time
test_defined
test_default_constants
test_delegated_array_equals
Expand Down
15 changes: 15 additions & 0 deletions test/test_date_joda_time.rb
@@ -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

0 comments on commit 47e7cb5

Please sign in to comment.