diff options
author | Jean Boussier <[email protected]> | 2021-11-15 11:37:40 +0100 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2021-11-16 22:51:40 +0900 |
commit | fa674cf7230e40bc96625ee97a6057e48bb20f0f (patch) | |
tree | 6bc5522936e2bd9086ac12c588a4f507ed7b5298 /test/date/test_date_parse.rb | |
parent | 17e64cca6b737060884f6fd9ab1c5055e9b49577 (diff) |
[ruby/date] `Date._<format>(nil)` should return an empty Hash
Fix: https://github.com/ruby/date/issues/39
This is how versions previous to 3.2.1 behaved and Active Support
currently rely on this behavior.
https://github.com/rails/rails/blob/90357af08048ef5076730505f6e7b14a81f33d0c/activesupport/lib/active_support/values/time_zone.rb#L383-L384
Any Rails application upgrading to date `3.2.1` might run into unexpected errors.
https://github.com/ruby/date/commit/8f2d7a0c7e
Diffstat (limited to 'test/date/test_date_parse.rb')
-rw-r--r-- | test/date/test_date_parse.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb index a486451ece..1217ee8be6 100644 --- a/test/date/test_date_parse.rb +++ b/test/date/test_date_parse.rb @@ -848,6 +848,9 @@ class TestDateParse < Test::Unit::TestCase h = Date._iso8601('') assert_equal({}, h) + + h = Date._iso8601(nil) + assert_equal({}, h) end def test__rfc3339 @@ -863,6 +866,9 @@ class TestDateParse < Test::Unit::TestCase h = Date._rfc3339('') assert_equal({}, h) + + h = Date._rfc3339(nil) + assert_equal({}, h) end def test__xmlschema @@ -945,6 +951,9 @@ class TestDateParse < Test::Unit::TestCase h = Date._xmlschema('') assert_equal({}, h) + + h = Date._xmlschema(nil) + assert_equal({}, h) end def test__rfc2822 @@ -977,6 +986,9 @@ class TestDateParse < Test::Unit::TestCase h = Date._rfc2822('') assert_equal({}, h) + + h = Date._rfc2822(nil) + assert_equal({}, h) end def test__httpdate @@ -997,6 +1009,9 @@ class TestDateParse < Test::Unit::TestCase h = Date._httpdate('') assert_equal({}, h) + + h = Date._httpdate(nil) + assert_equal({}, h) end def test__jisx0301 @@ -1073,6 +1088,9 @@ class TestDateParse < Test::Unit::TestCase h = Date._jisx0301('') assert_equal({}, h) + + h = Date._jisx0301(nil) + assert_equal({}, h) end def test_iso8601 |