Skip to content

Commit 3b8498b

Browse files
committed
Add testcases for non-ASCII constants/identifiers
PullRequest: truffleruby/2102
1 parent 65a961e commit 3b8498b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

spec/ruby/language/variables_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,3 +796,29 @@ module VariableSpecs
796796
end
797797
end
798798
end
799+
800+
describe 'Allowed characters' do
801+
it 'does not allow non-ASCII upcased characters at the beginning' do
802+
-> do
803+
eval <<-CODE
804+
def test
805+
ἍBB = 1
806+
end
807+
CODE
808+
end.should raise_error(SyntaxError, /dynamic constant assignment/)
809+
end
810+
811+
it 'allows non-ASCII lowercased characters at the beginning' do
812+
result = nil
813+
814+
eval <<-CODE
815+
def test
816+
μ = 1
817+
end
818+
819+
result = test
820+
CODE
821+
822+
result.should == 1
823+
end
824+
end

0 commit comments

Comments
 (0)