summaryrefslogtreecommitdiff
path: root/spec/ruby/language/variables_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-10-24 15:52:37 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-10-24 15:53:53 +0200
commit148961adcd0704d964fce920330a6301b9704c25 (patch)
tree1f1f0cb7326775788683c77f0e2cceb495d3cc95 /spec/ruby/language/variables_spec.rb
parent342fbae83c2e80d1b49656bc7c689cc7fe8980ce (diff)
Update to ruby/spec@4f59d86
Diffstat (limited to 'spec/ruby/language/variables_spec.rb')
-rw-r--r--spec/ruby/language/variables_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/ruby/language/variables_spec.rb b/spec/ruby/language/variables_spec.rb
index 8b67289df4..ce072baa2c 100644
--- a/spec/ruby/language/variables_spec.rb
+++ b/spec/ruby/language/variables_spec.rb
@@ -796,3 +796,32 @@ describe 'Local variable shadowing' do
end
end
end
+
+describe 'Allowed characters' do
+ ruby_version_is "2.6" do
+ # new feature in 2.6 -- https://bugs.ruby-lang.org/issues/13770
+ it 'does not allow non-ASCII upcased characters at the beginning' do
+ -> do
+ eval <<-CODE
+ def test
+ ἍBB = 1
+ end
+ CODE
+ end.should raise_error(SyntaxError, /dynamic constant assignment/)
+ end
+ end
+
+ it 'allows non-ASCII lowercased characters at the beginning' do
+ result = nil
+
+ eval <<-CODE
+ def test
+ μ = 1
+ end
+
+ result = test
+ CODE
+
+ result.should == 1
+ end
+end