From cf12aff0593a0aa70d957b96f03df8288c025938 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 5 Dec 2025 00:27:45 +0900 Subject: [Bug #21764] Propagate the encoding of ID to warning --- test/ruby/test_string.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 50dc5ec2f9..6fdc2bdaa8 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1886,6 +1886,17 @@ CODE assert_raise_with_message(TypeError, /\$;/) { $; = [] } + name = "\u{5206 5217}" + assert_separately([], "#{<<~"do;"}\n#{<<~"end;"}") + do; + alias $#{name} $; + assert_deprecated_warning(/\\$#{name}/) { $#{name} = "" } + assert_raise_with_message(TypeError, /\\$#{name}/) { $#{name} = 1 } + end; + end + + def test_fs_gc + return unless @cls == String assert_separately(%W[-W0], "#{<<~"begin;"}\n#{<<~'end;'}") bug = '[ruby-core:79582] $; must not be GCed' @@ -2761,7 +2772,7 @@ CODE assert_equal([S("abcdb"), S("c"), S("e")], S("abcdbce").rpartition(/b\Kc/)) end - def test_fs_setter + def test_rs return unless @cls == String assert_raise(TypeError) { $/ = 1 } @@ -2769,6 +2780,7 @@ CODE assert_separately([], "#{<<~"do;"}\n#{<<~"end;"}") do; alias $#{name} $/ + assert_deprecated_warning(/\\$#{name}/) { $#{name} = "" } assert_raise_with_message(TypeError, /\\$#{name}/) { $#{name} = 1 } end; end -- cgit v1.2.3