diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-05-20 17:28:30 -0700 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-05-21 12:23:14 -0700 |
| commit | 7b10660974dcdd7882a48a62cfc2a32c4a17aa85 (patch) | |
| tree | e89c1234a3f4faf724fe5db8079f8aec7267e233 /test/ruby | |
| parent | ef935705cfb1b4493b8b8cf112e435b554b3138a (diff) | |
Use rb_inspect for Ractor error
Previously the object was used directly, which calls `to_s` if defined.
We should use rb_inspect to get a value suitable for display to the
programmer.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13389
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_ractor.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_ractor.rb b/test/ruby/test_ractor.rb index ec94df361f..e61c6beffc 100644 --- a/test/ruby/test_ractor.rb +++ b/test/ruby/test_ractor.rb @@ -60,6 +60,14 @@ class TestRactor < Test::Unit::TestCase assert_unshareable(x, "can not make shareable object for #<Method: String(Kernel)#itself()>", exception: Ractor::Error) end + def test_shareability_error_uses_inspect + x = (+"").instance_exec { method(:to_s) } + def x.to_s + raise "this should not be called" + end + assert_unshareable(x, "can not make shareable object for #<Method: String#to_s()>", exception: Ractor::Error) + end + def test_default_thread_group assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; |
