diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-09-08 11:53:27 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-09-26 10:23:02 +0200 |
commit | 6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e (patch) | |
tree | e830df0ad8e9d5ad4413d1008115699b703e215b /test/-ext- | |
parent | 4a4c5028258e53f3395af29655a66bcef796fd73 (diff) | |
download | ruby-6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e.tar.gz |
[EXPERIMENTAL] Make Symbol#to_s return a frozen String
* Always the same frozen String for a given Symbol.
* Avoids extra allocations whenever calling Symbol#to_s.
* See [Feature #16150]
Diffstat (limited to 'test/-ext-')
-rw-r--r-- | test/-ext-/string/test_capacity.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/-ext-/string/test_capacity.rb b/test/-ext-/string/test_capacity.rb index df59e76778..f5830a033b 100644 --- a/test/-ext-/string/test_capacity.rb +++ b/test/-ext-/string/test_capacity.rb @@ -14,7 +14,9 @@ class Test_StringCapacity < Test::Unit::TestCase end def test_capacity_shared - assert_equal 0, capa(:abcdefghijklmnopqrstuvwxyz.to_s) + str = :abcdefghijklmnopqrstuvwxyz.to_s.dup + assert Bug::String.shared_string? str + assert_equal 0, capa(str) end def test_capacity_normal |