summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-09-08 11:53:27 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-09-26 10:23:02 +0200
commit6ffc045a817fbdf04a6945d3c260b55b0fa1fd1e (patch)
treee830df0ad8e9d5ad4413d1008115699b703e215b /test/-ext-
parent4a4c5028258e53f3395af29655a66bcef796fd73 (diff)
[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]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2437
Diffstat (limited to 'test/-ext-')
-rw-r--r--test/-ext-/string/test_capacity.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/-ext-/string/test_capacity.rb b/test/-ext-/string/test_capacity.rb
index df59e76..f5830a0 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