From 15ef28a991f66f65bb29751cf2bef3bcb51066fc Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 25 Feb 2017 02:31:03 +0000 Subject: [PATCH] NEWS: document String#-@ change * test/ruby/test_string.rb (test_uplus_minus): test deduplication [ruby-core:79747] [Feature #13077] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- NEWS | 5 +++++ test/ruby/test_string.rb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 33268b8762..2a0413f006 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,11 @@ with all sufficient information, see the ChangeLog file or Redmine * Thread#fetch [Feature #13009] +* String + + * String#-@ deduplicates unfrozen strings. Already-frozen + strings remain unchanged for compatibility. [Feature #13077] + === Stdlib updates (outstanding ones only) === Compatibility issues (excluding feature bug fixes) diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index d5166a82bc..da8bd5f05a 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2537,6 +2537,8 @@ CODE assert_not_equal(str.object_id, (+str).object_id) assert_equal(str.object_id, (-str).object_id) + bar = %w(b a r).join('') + assert_same(str, -bar, "uminus deduplicates [Feature #13077]") end def test_ord