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

test_string.rb: suppress warnings

* test/ruby/test_string.rb (test_match_method): use unique objects in
  TestString and TestString2.

* test/ruby/test_string.rb (test_ascii_incomat_inspect): suppress
  warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-10-11 06:50:29 +00:00
parent eddfa31bda
commit 88e326edda

View file

@ -1827,7 +1827,7 @@ class TestString < Test::Unit::TestCase
def test_match_method def test_match_method
assert_equal("bar", "foobarbaz".match(/bar/).to_s) assert_equal("bar", "foobarbaz".match(/bar/).to_s)
o = /foo/ o = Regexp.new('foo')
def o.match(x, y, z); x + y + z; end def o.match(x, y, z); x + y + z; end
assert_equal("foobarbaz", "foo".match(o, "bar", "baz")) assert_equal("foobarbaz", "foo".match(o, "bar", "baz"))
x = nil x = nil
@ -1983,11 +1983,15 @@ class TestString < Test::Unit::TestCase
assert_equal('"ab\\"c"', "ab\"c".encode(e).inspect, bug4081) assert_equal('"ab\\"c"', "ab\"c".encode(e).inspect, bug4081)
end end
begin begin
verbose, $VERBOSE = $VERBOSE, nil
ext = Encoding.default_external ext = Encoding.default_external
Encoding.default_external = "us-ascii" Encoding.default_external = "us-ascii"
$VERBOSE = verbose
i = "abc\"\\".force_encoding("utf-8").inspect i = "abc\"\\".force_encoding("utf-8").inspect
ensure ensure
$VERBOSE = nil
Encoding.default_external = ext Encoding.default_external = ext
$VERBOSE = verbose
end end
assert_equal('"abc\\"\\\\"', i, bug4081) assert_equal('"abc\\"\\\\"', i, bug4081)
end end