summaryrefslogtreecommitdiff
path: root/spec/ruby/core
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-11-19 12:43:38 +0900
committerNobuyoshi Nakada <[email protected]>2024-11-19 12:43:38 +0900
commit9c777f282f8482400d4b0c7993d520c18cb1b652 (patch)
tree087709ecbc982385e5492a170df770ee684842e7 /spec/ruby/core
parent727b2a29990022fc96eddb4c63271f0eac60d926 (diff)
[Bug #20900] Warn deprecated constant when removing
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12114
Diffstat (limited to 'spec/ruby/core')
-rw-r--r--spec/ruby/core/module/deprecate_constant_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/module/deprecate_constant_spec.rb b/spec/ruby/core/module/deprecate_constant_spec.rb
index aabef934c4..ec0de6782f 100644
--- a/spec/ruby/core/module/deprecate_constant_spec.rb
+++ b/spec/ruby/core/module/deprecate_constant_spec.rb
@@ -44,6 +44,15 @@ describe "Module#deprecate_constant" do
end
end
+ ruby_bug '#20900', ''...'3.4' do
+ describe "when removing the deprecated module" do
+ it "warns with a message" do
+ @module.deprecate_constant :PUBLIC1
+ -> { @module.module_eval {remove_const :PUBLIC1} }.should complain(/warning: constant .+::PUBLIC1 is deprecated/)
+ end
+ end
+ end
+
it "accepts multiple symbols and strings as constant names" do
@module.deprecate_constant "PUBLIC1", :PUBLIC2