1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Check by #name [ruby-core:90853] [Bug #15497]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2019-01-08 10:53:43 +00:00
parent 497075b3a1
commit e9dc6f6076

View file

@ -2061,17 +2061,13 @@ class TestModule < Test::Unit::TestCase
$foo
\u3042$
].each do |name|
assert_raise_with_message(NameError, /#{Regexp.quote(quote(name))}/) do
e = assert_raise(NameError) do
Module.new { attr_accessor name.to_sym }
end
assert_equal(name, e.name.to_s)
end
end
private def quote(name)
encoding = Encoding.default_internal || Encoding.default_external
(name.encoding == encoding || name.ascii_only?) ? name : name.inspect
end
class AttrTest
class << self
attr_accessor :cattr