diff options
author | Étienne Barrié <[email protected]> | 2024-05-27 11:22:39 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-05-28 07:32:33 +0200 |
commit | 1376881e9afe6ff673f64afa791cf30f57147ee2 (patch) | |
tree | a5ad297473381ac00c593ca2ca1ef93381fd3a00 /test/ruby/test_string.rb | |
parent | 2114d0af1e5790da365584a38ea7ee58670dc11b (diff) |
Stop marking chilled strings as frozen
They were initially made frozen to avoid false positives for cases such
as:
str = str.dup if str.frozen?
But this may cause bugs and is generally confusing for users.
[Feature #20205]
Co-authored-by: Jean Boussier <[email protected]>
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index ebe85dac82..9bd86dfb78 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -3617,17 +3617,16 @@ CODE def test_chilled_string chilled_string = eval('"chilled"') - # Chilled strings pretend to be frozen - assert_predicate chilled_string, :frozen? + assert_not_predicate chilled_string, :frozen? assert_not_predicate chilled_string.dup, :frozen? - assert_predicate chilled_string.clone, :frozen? + assert_not_predicate chilled_string.clone, :frozen? # @+ treat the original string as frozen assert_not_predicate(+chilled_string, :frozen?) assert_not_same chilled_string, +chilled_string - # @- the original string as mutable + # @- treat the original string as mutable assert_predicate(-chilled_string, :frozen?) assert_not_same chilled_string, -chilled_string end |