summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-03-25 09:24:21 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-03-25 10:26:56 +0900
commitfdd7ffb70ca6e9f7d790aadde86dbc8172e19f4d (patch)
tree0bdf7072fd2e9c18356e9f19694e4169f9ed5260 /test/ruby
parent95864a6e353b503920e9b0c3d65c0bab2ab4a937 (diff)
[Bug #20389] Chilled string cannot be a shared root
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 8df6d3277f..8ec80d06fc 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -3648,6 +3648,18 @@ CODE
Warning[:deprecated] = deprecated
end
+ def test_chilled_string_substring
+ deprecated = Warning[:deprecated]
+ Warning[:deprecated] = false
+ chilled_string = eval('"a chilled string."')
+ substring = chilled_string[0..-1]
+ assert_equal("a chilled string.", substring)
+ chilled_string[0..-1] = "This string is defrosted."
+ assert_equal("a chilled string.", substring)
+ ensure
+ Warning[:deprecated] = deprecated
+ end
+
private
def assert_bytesplice_result(expected, s, *args)