summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorÉtienne Barrié <etienne.barrie@gmail.com>2024-03-25 11:18:26 +0100
committerJean Boussier <jean.boussier@gmail.com>2024-03-26 12:54:54 +0100
commit2b08406cd0db0042520fb0346544660e10a4d93c (patch)
tree9b649ec091c72b13227687d6e19079f67c14da5b /test
parent8cfa8e87b2705fb356bbbb9ef719b5c5a54f9862 (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/string/test_chilled.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/-ext-/string/test_chilled.rb b/test/-ext-/string/test_chilled.rb
new file mode 100644
index 0000000000..dccab61ced
--- /dev/null
+++ b/test/-ext-/string/test_chilled.rb
@@ -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