string.c: warn non-nil $;

* string.c (rb_str_split_m): warn use of non-nil $;.

* string.c (rb_fs_setter): warn when set to non-nil value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2019-04-18 09:34:40 +00:00
parent eb3d3dfcc1
commit 4d1f86a1ff
3 changed files with 19 additions and 3 deletions

View file

@ -1702,7 +1702,7 @@ CODE
assert_equal([], "".split(//, 1))
ensure
$; = fs
EnvUtil.suppress_warning {$; = fs}
end
def test_split_with_block
@ -1742,7 +1742,7 @@ CODE
result = []; "".split(//, 1) {|s| result << s}
assert_equal([], result)
ensure
$; = fs
EnvUtil.suppress_warning {$; = fs}
end
def test_fs
@ -1750,7 +1750,7 @@ CODE
$; = []
}
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
assert_separately(%W[-W0], "#{<<~"begin;"}\n#{<<~'end;'}")
bug = '[ruby-core:79582] $; must not be GCed'
begin;
$; = " "
@ -1760,6 +1760,13 @@ CODE
GC.start
assert_equal([], "".split, bug)
end;
begin
fs = $;
assert_warn(/\$; will be deprecated/) {$; = " "}
ensure
EnvUtil.suppress_warning {$; = fs}
end
end
def test_split_encoding