mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Improve warning message
https://github.com/ruby/ruby/pull/2637#discussion_r341812475
This commit is contained in:
parent
452bee3ee8
commit
31110d820c
2 changed files with 4 additions and 4 deletions
4
re.c
4
re.c
|
@ -3324,7 +3324,7 @@ rb_reg_match_m(int argc, VALUE *argv, VALUE re)
|
|||
}
|
||||
|
||||
if (NIL_P(str)) {
|
||||
rb_warn("given argument is nil");
|
||||
rb_warn("given argument is nil; this will raise a TypeError in the next release");
|
||||
}
|
||||
pos = reg_match_pos(re, &str, pos);
|
||||
if (pos < 0) {
|
||||
|
@ -3372,7 +3372,7 @@ rb_reg_match_p(VALUE re, VALUE str, long pos)
|
|||
int tmpreg;
|
||||
|
||||
if (NIL_P(str)) {
|
||||
rb_warn("given argument is nil");
|
||||
rb_warn("given argument is nil; this will raise a TypeError in the next release");
|
||||
return Qfalse;
|
||||
}
|
||||
str = SYMBOL_P(str) ? rb_sym2str(str) : StringValue(str);
|
||||
|
|
|
@ -100,7 +100,7 @@ describe "Regexp#match" do
|
|||
|
||||
ruby_version_is "2.7"..."3.0" do
|
||||
it "warns the deprecation when the given argument is nil" do
|
||||
-> { /foo/.match(nil) }.should complain(/given argument is nil/)
|
||||
-> { /foo/.match(nil) }.should complain(/given argument is nil; this will raise a TypeError in the next release/)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -151,7 +151,7 @@ describe "Regexp#match?" do
|
|||
|
||||
ruby_version_is "2.7"..."3.0" do
|
||||
it "warns the deprecation" do
|
||||
-> { /./.match?(nil) }.should complain(/given argument is nil/)
|
||||
-> { /./.match?(nil) }.should complain(/given argument is nil; this will raise a TypeError in the next release/)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue