Expose rb_str_chilled_p

Some extensions (like stringio) may need to differentiate between
chilled strings and frozen strings.

They can now use rb_str_chilled_p but must check for its presence since
the function will be removed when chilled strings are removed.

[Bug #20389]

[Feature #20205]

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
This commit is contained in:
Étienne Barrié 2024-03-25 11:18:26 +01:00 committed by Jean Boussier
parent 8cfa8e87b2
commit 2b08406cd0
5 changed files with 212 additions and 0 deletions

View file

@ -0,0 +1,19 @@
require 'test/unit'
require '-test-/string'
class Test_String_ChilledString < Test::Unit::TestCase
def test_rb_str_chilled_p
str = ""
assert_equal true, Bug::String.rb_str_chilled_p(str)
end
def test_rb_str_chilled_p_frozen
str = "".freeze
assert_equal false, Bug::String.rb_str_chilled_p(str)
end
def test_rb_str_chilled_p_mutable
str = "".dup
assert_equal false, Bug::String.rb_str_chilled_p(str)
end
end