mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
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:
parent
8cfa8e87b2
commit
2b08406cd0
5 changed files with 212 additions and 0 deletions
19
test/-ext-/string/test_chilled.rb
Normal file
19
test/-ext-/string/test_chilled.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue