[前][次][番号順一覧][スレッド一覧]

ruby-changes:33716

From: akr <ko1@a...>
Date: Sat, 3 May 2014 22:09:14 +0900 (JST)
Subject: [ruby-changes:33716] akr:r45797 (trunk): add tests.

akr	2014-05-03 22:09:07 +0900 (Sat, 03 May 2014)

  New Revision: 45797

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45797

  Log:
    add tests.

  Modified files:
    trunk/test/test_time.rb
Index: test/test_time.rb
===================================================================
--- test/test_time.rb	(revision 45796)
+++ test/test_time.rb	(revision 45797)
@@ -401,8 +401,23 @@ class TestTimeExtension < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/test_time.rb#L401
     assert_equal(Time.utc(2005, 8, 28, 06, 54, 20), Time.strptime("28/Aug/2005:06:54:20 +0000", "%d/%b/%Y:%T %z"))
     assert_equal(Time.at(1).localtime, Time.strptime("1", "%s"))
     assert_equal(false, Time.strptime('0', '%s').utc?)
-    assert_equal(3600, Time.strptime('0 +0100', '%s %z').utc_offset)
-    assert_equal(-7200, Time.strptime('20010203 -0200', '%Y%m%d %z').utc_offset)
+  end
+
+  def test_strptime_s_z
+    t = Time.strptime('0 +0100', '%s %z')
+    assert_equal(0, t.to_r)
+    assert_equal(3600, t.utc_offset)
+  end
+
+  def test_strptime_Ymd_z
+    t = Time.strptime('20010203 -0200', '%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(-7200, t.utc_offset)
   end
 
   def test_nsec

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]