aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-18 09:34:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-18 09:34:40 +0000
commit4d1f86a1ffceb3323b4e2fac82dfc40c5a382e9e (patch)
treeab728d5925c7d423c37a45250808a0303754dbe5 /test
parenteb3d3dfcc1ad61cb3040acfdf41f71c228b892e4 (diff)
downloadruby-4d1f86a1ffceb3323b4e2fac82dfc40c5a382e9e.tar.gz
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_string.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index f308cccbcd..d94c4da7ae 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -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