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

ruby-changes:47986

From: nobu <ko1@a...>
Date: Mon, 2 Oct 2017 20:43:40 +0900 (JST)
Subject: [ruby-changes:47986] nobu:r60100 (trunk): test_call.rb: refine test_safe_call

nobu	2017-10-02 20:43:36 +0900 (Mon, 02 Oct 2017)

  New Revision: 60100

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

  Log:
    test_call.rb: refine test_safe_call
    
    * test/ruby/test_call.rb (test_safe_call): rhs should not be
      evaluated when the receiver is nil.  simplified the assertion
      for  [Bug #13964].

  Modified files:
    trunk/test/ruby/test_call.rb
Index: test/ruby/test_call.rb
===================================================================
--- test/ruby/test_call.rb	(revision 60099)
+++ test/ruby/test_call.rb	(revision 60100)
@@ -50,9 +50,9 @@ class TestCall < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_call.rb#L50
 
     o = nil
     assert_nil(o&.x)
-    assert_nothing_raised(NoMethodError) {o&.x = 6}
-    assert_nothing_raised(NoMethodError) {o&.x *= 7}
-    assert_nothing_raised(NoMethodError) {o&.x *= 8; [].each {}}
+    assert_nothing_raised(NoMethodError) {o&.x = raise}
+    assert_nothing_raised(NoMethodError) {o&.x *= raise}
+    assert_nothing_raised(NoMethodError) {o&.x *= raise; nil}
   end
 
   def test_safe_call_evaluate_arguments_only_method_call_is_made

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

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