summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2025-06-03 16:06:58 +0900
committergit <[email protected]>2025-06-03 07:56:39 +0000
commita77ec9a22c22a93ee979809dc7e4bed57b52972f (patch)
treeb6b48c7601f57bed838bf3726819b35690e06687 /test
parent7d1190059fa872f1a6c2f51fde8c1971b8c2bcaf (diff)
[ruby/psych] Alias value or join to take in old Ruby
https://github.com/ruby/psych/commit/1a4d383efe
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_ractor.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_ractor.rb b/test/psych/test_ractor.rb
index f1c8327aa3..7821eed155 100644
--- a/test/psych/test_ractor.rb
+++ b/test/psych/test_ractor.rb
@@ -4,6 +4,10 @@ require_relative 'helper'
class TestPsychRactor < Test::Unit::TestCase
def test_ractor_round_trip
assert_ractor(<<~RUBY, require_relative: 'helper')
+ class Ractor
+ alias value take
+ end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders
+
obj = {foo: [42]}
obj2 = Ractor.new(obj) do |obj|
Psych.unsafe_load(Psych.dump(obj))
@@ -28,6 +32,10 @@ class TestPsychRactor < Test::Unit::TestCase
# Test is to make sure it works, even though usage is probably very low.
# The methods are not documented and might be deprecated one day
assert_ractor(<<~RUBY, require_relative: 'helper')
+ class Ractor
+ alias value take
+ end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders
+
r = Ractor.new do
Psych.add_builtin_type 'omap' do |type, val|
val * 2
@@ -41,6 +49,10 @@ class TestPsychRactor < Test::Unit::TestCase
def test_ractor_constants
assert_ractor(<<~RUBY, require_relative: 'helper')
+ class Ractor
+ alias value take
+ end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders
+
r = Ractor.new do
Psych.libyaml_version.join('.') == Psych::LIBYAML_VERSION
end.value