summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-26 12:21:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-26 12:21:51 +0000
commit33118bf77ba4c9e49e2c616e7c32911832e6c5e5 (patch)
tree3ddfd4fc08df9d596aa06c0cf84aea28ef0189a9 /test
parent9d389d6510d8dadfa2ee1e246b5e205d2eeb7de4 (diff)
Suppress warnings by other than self-assignments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_parse.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 36ff776db9..769500a261 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -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