From 15ee45080133c19d167760d577d72540a9db0ec9 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 4 Mar 2025 13:40:13 +0100 Subject: Move in-place interning spec to Ruby's tests Fix: https://github.com/ruby/spec/issues/1249 JRuby and TruffleRuby can't implement this behavior. While quite a lot of code out there relies on it, if it's not implemented it will simply result in sligthly less efficient code, so not the end of the world. --- test/ruby/test_string.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index d2099607fd..1011967fe9 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -3397,6 +3397,12 @@ CODE assert_same(str, bar, "uminus deduplicates [Feature #13077] str: #{ObjectSpace.dump(str)} bar: #{ObjectSpace.dump(bar)}") end + def test_uminus_dedup_in_place + dynamic = "this string is unique and frozen #{rand}".freeze + assert_same dynamic, -dynamic + assert_same dynamic, -dynamic.dup + end + def test_uminus_frozen return unless @cls == String -- cgit v1.2.3