Skip to content

Commit

Permalink
Ruby spec for multibyte constant names
Browse files Browse the repository at this point in the history
  • Loading branch information
Yorick Peterse committed Apr 29, 2015
1 parent af157db commit d3bacd4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/ruby/core/module/const_defined_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../fixtures/constants', __FILE__)

Expand Down Expand Up @@ -75,6 +77,10 @@
ConstantSpecs.const_defined?("ClassC::CS_CONST1").should be_true
end

it "returns true when passed a scoped constant name with unicode characters" do
ConstantSpecs.const_defined?("CS_CONSTλ").should be_true
end

it "returns true when passed a scoped constant name for a constant in the inheritance hierarchy and the inherited flag is default" do
ConstantSpecs::ClassD.const_defined?("ClassE::CS_CONST2").should be_true
end
Expand Down
4 changes: 4 additions & 0 deletions spec/ruby/fixtures/constants.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

# Contains all static code examples of all constants behavior in language and
# library specs. The specs include language/constants_spec.rb and the specs
# for Module#const_defined?, Module#const_get, Module#const_set,
Expand Down Expand Up @@ -248,6 +250,8 @@ def self.const211; CS_CONST211; end
end
end

CS_CONSTλ = :const_unicode

# Constants
CS_CONST2 = :const2 # only defined here
CS_CONST17 = :const17_1
Expand Down

0 comments on commit d3bacd4

Please sign in to comment.