summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-05 00:27:45 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-05 00:27:45 +0900
commitcf12aff0593a0aa70d957b96f03df8288c025938 (patch)
treec46cfc4b04ec03fe6d603d745cca29a4cfba7fc7 /test/ruby
parent465a86c3417d2936c311d9571aa9b6494a83eed8 (diff)
[Bug #21764] Propagate the encoding of ID to warning
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb14
1 files changed, 13 insertions, 1 deletions
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