summaryrefslogtreecommitdiff
path: root/test/psych/test_date_time.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-09 09:22:53 +0900
committergit <svn-admin@ruby-lang.org>2022-09-07 09:44:14 +0900
commitcbdde8e0c574f19e170c3de05dd0bbd276acb741 (patch)
tree503a42ff4e6ea3a5e8281e90f4e7f7c738bfd5e5 /test/psych/test_date_time.rb
parentbfa6d0f6d75f375e4055fb7f5af8194aa1de5947 (diff)
[ruby/psych] Dump Date/DateTime as proleptic Gregorian date as well as Time
Fix ruby/psych#572 https://github.com/ruby/psych/commit/92304269bc
Diffstat (limited to 'test/psych/test_date_time.rb')
-rw-r--r--test/psych/test_date_time.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb
index 6f1e8b509e..3379bd24bf 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