aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/language/constants_spec.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-20 20:38:57 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-20 20:38:57 +0000
commit6204e0804b24f1675b49d5880da014411bcfb831 (patch)
treece6c00bf078fc416936ca3cdc972b9b3c1c78dae /spec/ruby/language/constants_spec.rb
parent58573c33e4720315ed27491e31dcc22892e1ce95 (diff)
downloadruby-6204e0804b24f1675b49d5880da014411bcfb831.tar.gz
Update to ruby/spec@35a9fba
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/language/constants_spec.rb')
-rw-r--r--spec/ruby/language/constants_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/ruby/language/constants_spec.rb b/spec/ruby/language/constants_spec.rb
index 5b111f4e81..354cc4b9a3 100644
--- a/spec/ruby/language/constants_spec.rb
+++ b/spec/ruby/language/constants_spec.rb
@@ -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