summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcus Stollsteimer <sto.mar@web.de>2017-04-13 12:35:09 +0200
committerMarcus Stollsteimer <sto.mar@web.de>2017-05-22 15:56:00 +0200
commit3719891f6f066c870ebc605eda55bcbfcdc44b47 (patch)
tree0bf652868881ed9952404685cf2c47e754e80069 /test
parentc91c4ad74ff768255ed83b07eff5d5541adc4909 (diff)
downloadpsych-3719891f6f066c870ebc605eda55bcbfcdc44b47.zip
Add tests for time with usec and with time zone offset
Add test cases for times with nonzero usec, and for times other than UTC. Note that in the latter case the test only ensures that the restored time designates the same point in time, not that is has the same time zone offset.
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_date_time.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb
index 443669d..7745eb4 100644
--- a/test/psych/test_date_time.rb
+++ b/test/psych/test_date_time.rb
@@ -9,10 +9,25 @@ module Psych
assert_cycle time
end
+ def test_usec
+ time = Time.utc(2017, 4, 13, 12, 0, 0, 5)
+ assert_cycle time
+ end
+
+ def test_non_utc
+ time = Time.new(2017, 4, 13, 12, 0, 0.5, "+09:00")
+ assert_cycle time
+ end
+
def test_new_datetime
assert_cycle DateTime.new
end
+ def test_datetime_non_utc
+ dt = DateTime.new(2017, 4, 13, 12, 0, 0.5, "+09:00")
+ assert_cycle dt
+ end
+
def test_invalid_date
assert_cycle "2013-10-31T10:40:07-000000000000033"
end