summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-03-04 13:40:13 +0100
committerJean Boussier <[email protected]>2025-03-04 15:23:38 +0100
commit15ee45080133c19d167760d577d72540a9db0ec9 (patch)
tree0169b7768ae94b385fcc13d430a95a2b0a906740 /test/ruby
parent5de02d64878246eb04ab3654c7fcb8b119a89c46 (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12850
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb6
1 files changed, 6 insertions, 0 deletions
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