aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-02 11:43:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-02 11:43:36 +0000
commitecce6b524c28ba398105eac554d31a09e2474231 (patch)
tree3d54421250ef7211b58fa778481196573653c6e2
parentd9e226503da1e6ee60f43f4f820a70353b5d7e33 (diff)
downloadruby-ecce6b524c28ba398105eac554d31a09e2474231.tar.gz
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]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_call.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 18203ce731..2a1b671cac 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -50,9 +50,9 @@ class TestCall < Test::Unit::TestCase
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