1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Proc.new: change deprecation warning for clarity (issue #15539)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2019-04-13 00:56:12 +00:00
parent 95a8276630
commit d3da5fbd30
3 changed files with 5 additions and 5 deletions

2
proc.c
View file

@ -710,7 +710,7 @@ proc_new(VALUE klass, int8_t is_lambda)
rb_raise(rb_eArgError, proc_without_block);
}
else {
rb_warn(proc_without_block);
rb_warn("Capturing the given block using Proc.new is deprecated; use `&block` instead");
}
}
#else

View file

@ -56,7 +56,7 @@ describe "Kernel#proc" do
-> {
some_method { "hello" }
}.should complain(/tried to create Proc object without a block/)
}.should complain(/Capturing the given block using Proc.new is deprecated/)
end
end

View file

@ -194,11 +194,11 @@ describe "Proc.new without a block" do
ruby_version_is "2.7" do
it "can be created if invoked from within a method with a block" do
lambda { ProcSpecs.new_proc_in_method { "hello" } }.should complain(/tried to create Proc object without a block/)
lambda { ProcSpecs.new_proc_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
end
it "can be created if invoked on a subclass from within a method with a block" do
lambda { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should complain(/tried to create Proc object without a block/)
lambda { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/)
end
@ -209,7 +209,7 @@ describe "Proc.new without a block" do
-> {
some_method { "hello" }
}.should complain(/tried to create Proc object without a block/)
}.should complain(/Capturing the given block using Proc.new is deprecated/)
end
end
end