ruby-changes:65918
From: Kir <ko1@a...>
Date: Thu, 22 Apr 2021 11:51:52 +0900 (JST)
Subject: [ruby-changes:65918] 53d153e42c (master): [ruby/time] Make Time friendly to Ractor
https://git.ruby-lang.org/ruby.git/commit/?id=53d153e42c From 53d153e42c90f48ac35316b9fd69b8819aa4e7d3 Mon Sep 17 00:00:00 2001 From: Kir Shatrov <shatrov@m...> Date: Fri, 22 Jan 2021 08:42:30 +0300 Subject: [ruby/time] Make Time friendly to Ractor https://github.com/ruby/time/commit/c784e4f166 --- lib/time.rb | 1 + test/test_time.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/time.rb b/lib/time.rb index a40e2fe..bd20a1a 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/time.rb#L1 # frozen_string_literal: true +# shareable_constant_value: literal require 'date' diff --git a/test/test_time.rb b/test/test_time.rb index ca20788..d56daeb 100644 --- a/test/test_time.rb +++ b/test/test_time.rb @@ -62,6 +62,13 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc: https://github.com/ruby/ruby/blob/trunk/test/test_time.rb#L62 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) -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/