diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-08-09 09:22:53 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-08-09 09:22:53 +0900 |
commit | 92304269bc91e973aca20af1ad4c0bfec786ad6a (patch) | |
tree | 590af2ebf086dd0a8bca98c8caaaf08eb2a8e244 /test | |
parent | 2366075e0fcb01ff92831f9179bc000ec4fbb8c4 (diff) | |
download | psych-92304269bc91e973aca20af1ad4c0bfec786ad6a.tar.gz |
Dump Date/DateTime as proleptic Gregorian date as well as Time
Fix ruby/psych#572
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_date_time.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb index 6f1e8b5..3379bd2 100644 --- a/test/psych/test_date_time.rb +++ b/test/psych/test_date_time.rb @@ -44,6 +44,26 @@ module Psych assert_match(/12:00:00-05:00/, cycled.last.to_s) end + def test_julian_date + d = Date.new(1582, 10, 4, Date::GREGORIAN) + assert_cycle d + end + + def test_proleptic_gregorian_date + d = Date.new(1582, 10, 14, Date::GREGORIAN) + assert_cycle d + end + + def test_julian_datetime + dt = DateTime.new(1582, 10, 4, 23, 58, 59, 0, Date::GREGORIAN) + assert_cycle dt + end + + def test_proleptic_gregorian_datetime + dt = DateTime.new(1582, 10, 14, 23, 58, 59, 0, Date::GREGORIAN) + assert_cycle dt + end + def test_invalid_date assert_cycle "2013-10-31T10:40:07-000000000000033" end |