Skip to content

Commit 8f226cb

Browse files
committed
Guard new spec to run only on Ruby 2.6+
Before Ruby 2.6, an identifier that starts with a non-ASCII upcased character is treated as a variable, instead.
1 parent 3b8498b commit 8f226cb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

spec/ruby/language/variables_spec.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -798,14 +798,17 @@ module VariableSpecs
798798
end
799799

800800
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/)
801+
ruby_version_is "2.6" do
802+
# new feature in 2.6 -- https://bugs.ruby-lang.org/issues/13770
803+
it 'does not allow non-ASCII upcased characters at the beginning' do
804+
-> do
805+
eval <<-CODE
806+
def test
807+
ἍBB = 1
808+
end
809+
CODE
810+
end.should raise_error(SyntaxError, /dynamic constant assignment/)
811+
end
809812
end
810813

811814
it 'allows non-ASCII lowercased characters at the beginning' do

0 commit comments

Comments
 (0)