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

ruby-changes:50847

From: nobu <ko1@a...>
Date: Sun, 1 Apr 2018 11:00:41 +0900 (JST)
Subject: [ruby-changes:50847] nobu:r63054 (trunk): test_time_tz.rb: Kiritimati tzdata fix

nobu	2018-04-01 11:00:36 +0900 (Sun, 01 Apr 2018)

  New Revision: 63054

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63054

  Log:
    test_time_tz.rb: Kiritimati tzdata fix
    
    * test/ruby/test_time_tz.rb (TestTimeTZ#test_pacific_kiritimati):
      fix the expected data at the skip of New Year's Eve 1994.
      [Bug #14655]

  Modified files:
    trunk/test/ruby/test_time_tz.rb
Index: test/ruby/test_time_tz.rb
===================================================================
--- test/ruby/test_time_tz.rb	(revision 63053)
+++ test/ruby/test_time_tz.rb	(revision 63054)
@@ -89,6 +89,9 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L89
       Time.local(1951, 5, 6, 1, 0, 0).dst?   # DST with fixed tzdata
     end
   }
+  CORRECT_KIRITIMATI_SKIP_1994 = with_tz("Pacific/Kiritimati") {
+    Time.local(1994, 12, 31, 0, 0, 0).year == 1995
+  }
 
   def time_to_s(t)
     t.to_s
@@ -178,9 +181,17 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L181
 
   def test_pacific_kiritimati
     with_tz(tz="Pacific/Kiritimati") {
-      assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
-      assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
-      assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
+      assert_time_constructor(tz, "1994-12-30 00:00:00 -1000", :local, [1994,12,30,0,0,0])
+      assert_time_constructor(tz, "1994-12-30 23:59:59 -1000", :local, [1994,12,30,23,59,59])
+      if CORRECT_KIRITIMATI_SKIP_1994
+        assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1994,12,31,0,0,0])
+        assert_time_constructor(tz, "1995-01-01 23:59:59 +1400", :local, [1994,12,31,23,59,59])
+        assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1995,1,1,0,0,0])
+      else
+        assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
+        assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
+        assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
+      end
       assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,2,0,0,0])
     }
   end

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

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