[前][次][番号順一覧][スレッド一覧]

ruby-changes:47914

From: nobu <ko1@a...>
Date: Tue, 26 Sep 2017 21:21:56 +0900 (JST)
Subject: [ruby-changes:47914] nobu:r60033 (trunk): Suppress warnings by other than self-assignments

nobu	2017-09-26 21:21:51 +0900 (Tue, 26 Sep 2017)

  New Revision: 60033

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60033

  Log:
    Suppress warnings by other than self-assignments

  Modified files:
    trunk/test/ruby/test_parse.rb
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 60032)
+++ test/ruby/test_parse.rb	(revision 60033)
@@ -174,6 +174,7 @@ class TestParse < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L174
     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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L184
       END
     end
 
-    c = Class.new
     assert_raise(SyntaxError) do
       eval <<-END, nil, __FILE__, __LINE__+1
         $1 &= 1
@@ -698,15 +698,17 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L698
   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__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L778
     $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__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L791
     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__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L846
     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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]