summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 16:32:38 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 16:32:38 +0000
commit22a852a8c0b960578d9e9846a2d11f8940a3f580 (patch)
treefdba019b49d0a0b2ba78b56a40a83c0564c5d81d /test/-ext-
parentce701babaea99b69e8a90f0dc929c7f60c1bacf2 (diff)
merge revision(s) 54137,54184: [Backport #12227]
* test/-ext-/time/test_new.rb (test_timespec_new): Time#gmtoff values are the same only when both or neither of the Time objects are in summer time (daylight-saving time). * test/-ext-/time/test_new.rb (test_timespec_new): change a gmtoff test to a better one that does not depend on whether the current time is in summer time or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-')
-rw-r--r--test/-ext-/time/test_new.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/-ext-/time/test_new.rb b/test/-ext-/time/test_new.rb
index 699201fda5..8283bd6828 100644
--- a/test/-ext-/time/test_new.rb
+++ b/test/-ext-/time/test_new.rb
@@ -23,7 +23,11 @@ class Bug::Time::Test_New < Test::Unit::TestCase
assert_equal(false, Bug::Time.timespec_new(1447087832, 476451125, 0).utc?)
assert_equal(true, Bug::Time.timespec_new(1447087832, 476451125, 0x7ffffffe).utc?)
assert_equal(false, Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).utc?)
- assert_equal(Time.now.gmtoff, Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).gmtoff)
+ # Cannot compare Time.now.gmtoff with
+ # Bug::Time.timespec_new(1447087832, 476451125, 0x7fffffff).gmtoff, because
+ # it depends on whether the current time is in summer time (daylight-saving time) or not.
+ t = Time.now
+ assert_equal(t.gmtoff, Bug::Time.timespec_new(t.tv_sec, t.tv_nsec, 0x7fffffff).gmtoff)
assert_time_equal(Time.at(1447087832, 476451.125).localtime(86399),
Bug::Time.timespec_new(1447087832, 476451125, 86399))
assert_time_equal(Time.at(1447087832, 476451.125).localtime(-86399),