summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2024-12-19 10:32:14 -0500
committerGitHub <noreply@github.com>2024-12-19 10:32:14 -0500
commitce849d565bf6aae8e0179fffb04eb1f665f17347 (patch)
tree8daa5676e7234f2aafbc18635e7d4b4d861d76cf /test/ruby
parent7b2ae8df905d7bbc084d31a8f55cecc7e7c422b3 (diff)
ruby2_keywords warnings: Quote non-UTF8 method names fully
It used to quote only part of the method name because NUL byte in the method terminates the C string: ``` (irb)> "abcdef".encode("UTF-16LE").bytes => [97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0] ``` ``` expected: /abcdef/ actual: warning: Skipping set of ruby2_keywords flag for a (method not defined in Ruby)\n". ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12396 Merged-By: XrXr
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_keyword.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 6da1b73c15..4563308fa2 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -2794,6 +2794,12 @@ class TestKeywordArguments < Test::Unit::TestCase
assert_nil(c.send(:ruby2_keywords, :bar))
end
+ utf16_sym = "abcdef".encode("UTF-16LE").to_sym
+ c.send(:define_method, utf16_sym, c.instance_method(:itself))
+ assert_warn(/abcdef/) do
+ assert_nil(c.send(:ruby2_keywords, utf16_sym))
+ end
+
o = Object.new
class << o
alias bar p