1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/time] Make Time friendly to Ractor

https://github.com/ruby/time/commit/c784e4f166
This commit is contained in:
Kir Shatrov 2021-01-22 08:42:30 +03:00 committed by Hiroshi SHIBATA
parent 609de71f04
commit 53d153e42c
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 8 additions and 0 deletions

View file

@ -1,4 +1,5 @@
# frozen_string_literal: true
# shareable_constant_value: literal
require 'date'

View file

@ -62,6 +62,13 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
assert_equal(true, t.utc?)
end
if defined?(Ractor)
def test_rfc2822_ractor
actual = Ractor.new { Time.rfc2822("Fri, 21 Nov 1997 09:55:06 -0600") }.take
assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600, actual)
end
end
def test_encode_rfc2822
t = Time.utc(1)
assert_equal("Mon, 01 Jan 0001 00:00:00 -0000", t.rfc2822)