1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2019-01-20 20:38:57 +00:00
parent 58573c33e4
commit 6204e0804b
147 changed files with 2728 additions and 21522 deletions

View file

@ -713,3 +713,35 @@ describe "Module#public_constant marked constants" do
end
end
end
describe 'Allowed characters' do
it 'allows not ASCII characters in the middle of a name' do
mod = Module.new
mod.const_set("BBἍBB", 1)
eval("mod::BBἍBB").should == 1
end
it 'does not allow not ASCII characters that cannot be upcased or lowercased at the beginning' do
-> do
Module.new.const_set("થBB", 1)
end.should raise_error(NameError, /wrong constant name/)
end
ruby_version_is ""..."2.6" do
it 'does not allow not ASCII upcased characters at the beginning' do
-> do
Module.new.const_set("ἍBB", 1)
end.should raise_error(NameError, /wrong constant name/)
end
end
ruby_version_is "2.6" do
it 'allows not ASCII upcased characters at the beginning' do
mod = Module.new
mod.const_set("ἍBB", 1)
eval("mod::ἍBB").should == 1
end
end
end