aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-03 15:23:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-03 15:23:29 +0000
commitc4f29a657691a70165b937e43e608565da2eca49 (patch)
tree130be1aae3503a2e0b0c3d53c6492ea1315fa947 /test/test_time.rb
parent0a76ec34eac00a971617d833d2c42ed68f12f911 (diff)
downloadruby-c4f29a657691a70165b937e43e608565da2eca49.tar.gz
* lib/time.rb (make_time): Produce fixed-offset time object if
appropriate. (Time.strptime): Use d[:zone] instead of d[:offset]. * lib/rss/rss.rb (Time.w3cdtf): Produce fixed-offset time object if appropriate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_time.rb')
-rw-r--r--test/test_time.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb
index 1427089abb..fe8fb9288e 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -407,6 +407,10 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
t = Time.strptime('0 +0100', '%s %z')
assert_equal(0, t.to_r)
assert_equal(3600, t.utc_offset)
+ t = Time.strptime('0 UTC', '%s %z')
+ assert_equal(0, t.to_r)
+ assert_equal(0, t.utc_offset)
+ assert_equal(true, t.utc?)
end
def test_strptime_Ymd_z
@@ -418,6 +422,15 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
assert_equal(0, t.min)
assert_equal(0, t.sec)
assert_equal(-7200, t.utc_offset)
+ t = Time.strptime('20010203 UTC', '%Y%m%d %z')
+ assert_equal(2001, t.year)
+ assert_equal(2, t.mon)
+ assert_equal(3, t.day)
+ assert_equal(0, t.hour)
+ assert_equal(0, t.min)
+ assert_equal(0, t.sec)
+ assert_equal(0, t.utc_offset)
+ assert_equal(true, t.utc?)
end
def test_nsec