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

test/ruby/test_string.rb: ensure restoring $/

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-12-02 06:12:56 +00:00
parent 8130ee5c9d
commit 4a7c767ed2

View file

@ -381,6 +381,8 @@ CODE
$/ = save $/ = save
assert_equal(S("a").hash, S("a\u0101").chomp(S("\u0101")).hash, '[ruby-core:22414]') assert_equal(S("a").hash, S("a\u0101").chomp(S("\u0101")).hash, '[ruby-core:22414]')
ensure
$/ = save
end end
def test_chomp! def test_chomp!
@ -437,6 +439,8 @@ CODE
assert_equal("foo\r", s) assert_equal("foo\r", s)
assert_equal(S("a").hash, S("a\u0101").chomp!(S("\u0101")).hash, '[ruby-core:22414]') assert_equal(S("a").hash, S("a\u0101").chomp!(S("\u0101")).hash, '[ruby-core:22414]')
ensure
$/ = save
end end
def test_chop def test_chop
@ -665,6 +669,7 @@ CODE
S("hello!world").lines.each {|x| res << x} S("hello!world").lines.each {|x| res << x}
assert_equal(S("hello!"), res[0]) assert_equal(S("hello!"), res[0])
assert_equal(S("world"), res[1]) assert_equal(S("world"), res[1])
ensure
$/ = save $/ = save
end end
@ -807,6 +812,8 @@ CODE
assert_nothing_raised(bug7646) do assert_nothing_raised(bug7646) do
"\n\u0100".each_line("\n") {} "\n\u0100".each_line("\n") {}
end end
ensure
$/ = save
end end
def test_lines def test_lines