diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-04-04 23:45:25 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-04-04 23:45:25 +0000 |
commit | 5572ae0f2886e0659984ead18515aa43444c0dc1 (patch) | |
tree | ae0e9cdaa706ef05d2fdcb00fc33b928cedf5681 /test | |
parent | fd734d4992f68fb6d2e97e65cf97f6629e13a108 (diff) |
merge revision(s) f4be7a510eebbe6507ba41d138d7d252f4a68e90,9441f3f97087a4325ee80911859d37da41fa5050: [Backport #17504]
Added tests for Time#getlocal with UTC offset
---
test/ruby/test_time.rb | 8 ++++++++
1 file changed, 8 insertions(+)
Allow UTC offset without colons per ISO-8601 [Bug #17504]
---
test/ruby/test_time.rb | 6 ++++++
time.c | 44 +++++++++++++++++++++++++++++---------------
2 files changed, 35 insertions(+), 15 deletions(-)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_time.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 6a55af139f..3b3711b805 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -1108,6 +1108,14 @@ class TestTime < Test::Unit::TestCase } 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 |