summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-09-01 21:22:20 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2020-09-02 00:05:14 -0400
commit5e16857315bf55307c5fc887ca6f03bfa0630a93 (patch)
treed42bcc39f4cdfb958d620f3d1389f2aa677b77cb /spec/ruby/language
parent11922b5e030808b16fd2c604637e046b2d01b0f0 (diff)
Fix constant names set using const_set on a singleton class
Fixes [Bug #14895]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3502
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/module_spec.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/ruby/language/module_spec.rb b/spec/ruby/language/module_spec.rb
index 1b41e184bb..cbc7149359 100644
--- a/spec/ruby/language/module_spec.rb
+++ b/spec/ruby/language/module_spec.rb
@@ -69,10 +69,20 @@ describe "Assigning an anonymous module to a constant" do
mod.name.should == "ModuleSpecs_CS1"
end
- it "does not set the name of a module scoped by an anonymous module" do
- a, b = Module.new, Module.new
- a::B = b
- b.name.should be_nil
+ ruby_version_is ""..."3.0" do
+ it "does not set the name of a module scoped by an anonymous module" do
+ a, b = Module.new, Module.new
+ a::B = b
+ b.name.should be_nil
+ end
+ end
+
+ ruby_version_is "3.0" do
+ it "sets the name of a module scoped by an anonymous module" do
+ a, b = Module.new, Module.new
+ a::B = b
+ b.name.should.end_with? '::B'
+ end
end
it "sets the name of contained modules when assigning a toplevel anonymous module" do