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

ruby-changes:64720

From: Nobuyoshi <ko1@a...>
Date: Sun, 3 Jan 2021 23:59:05 +0900 (JST)
Subject: [ruby-changes:64720] f4be7a510e (master): Added tests for Time#getlocal with UTC offset

https://git.ruby-lang.org/ruby.git/commit/?id=f4be7a510e

From f4be7a510eebbe6507ba41d138d7d252f4a68e90 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 3 Jan 2021 23:52:02 +0900
Subject: Added tests for Time#getlocal with UTC offset


diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 4c24c28..3f5cb9d 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -1212,6 +1212,14 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L1212
     }
   end
 
+  def test_getlocal_utc_offset
+    t = Time.gm(2000)
+    assert_equal [00, 30, 21, 31, 12, 1999], t.getlocal("-02:30").to_a[0, 6]
+    assert_equal [00, 00,  9,  1,  1, 2000], t.getlocal("+09:00").to_a[0, 6]
+    assert_equal [20, 29, 21, 31, 12, 1999], t.getlocal("-02:30:40").to_a[0, 6]
+    assert_equal [35, 10,  9,  1,  1, 2000], t.getlocal("+09:10:35").to_a[0, 6]
+  end
+
   def test_getlocal_nil
     now = Time.now
     now2 = nil
-- 
cgit v0.10.2


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

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