mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Suppress warnings by other than self-assignments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9d389d6510
commit
33118bf77b
1 changed files with 9 additions and 5 deletions
|
@ -174,6 +174,7 @@ class TestParse < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
c = Class.new
|
||||
c.freeze
|
||||
assert_nothing_raised(SyntaxError) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
if false
|
||||
|
@ -183,7 +184,6 @@ class TestParse < Test::Unit::TestCase
|
|||
END
|
||||
end
|
||||
|
||||
c = Class.new
|
||||
assert_raise(SyntaxError) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
$1 &= 1
|
||||
|
@ -698,15 +698,17 @@ x = __ENCODING__
|
|||
def test_invalid_char
|
||||
bug10117 = '[ruby-core:64243] [Bug #10117]'
|
||||
invalid_char = /Invalid char `\\x01'/
|
||||
x = x = 1
|
||||
x = 1
|
||||
assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117)
|
||||
assert_syntax_error("\x01x", invalid_char, bug10117)
|
||||
assert_equal(nil, eval("\x04x"))
|
||||
assert_equal 1, x
|
||||
end
|
||||
|
||||
def test_literal_concat
|
||||
x = x = "baz"
|
||||
x = "baz"
|
||||
assert_equal("foobarbaz", eval('"foo" "bar#{x}"'))
|
||||
assert_equal("baz", x)
|
||||
end
|
||||
|
||||
def test_unassignable
|
||||
|
@ -776,7 +778,7 @@ x = __ENCODING__
|
|||
$VERBOSE = true
|
||||
stderr = $stderr
|
||||
$stderr = StringIO.new("")
|
||||
x = x = 1
|
||||
x = 1
|
||||
assert_nil eval("x; nil")
|
||||
assert_nil eval("1+1; nil")
|
||||
assert_nil eval("1.+(1); nil")
|
||||
|
@ -789,6 +791,7 @@ x = __ENCODING__
|
|||
assert_nil eval("true; nil")
|
||||
assert_nil eval("false; nil")
|
||||
assert_nil eval("defined?(1); nil")
|
||||
assert_equal 1, x
|
||||
|
||||
assert_raise(SyntaxError) do
|
||||
eval %q(1; next; 2)
|
||||
|
@ -843,10 +846,11 @@ x = __ENCODING__
|
|||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
x = x = "bar"
|
||||
x = "bar"
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
:"foo#{"x"}baz" ? 1 : 2
|
||||
END
|
||||
assert_equal "bar", x
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue