From 9c777f282f8482400d4b0c7993d520c18cb1b652 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 19 Nov 2024 12:43:38 +0900 Subject: [Bug #20900] Warn deprecated constant when removing --- spec/ruby/core/module/deprecate_constant_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/ruby/core') 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 -- cgit v1.2.3